Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Passing Variables

Passing Variables

Passing Variables

Please help,  I am tring to pass field names from a text box to a variable, and then replace a field on my output file with whatever the field entered in the text box is, but it is replaceing the output field with the field name.

ex.  they enter F1 in text box txtName

lcName = alltrim(ThisForm.txtName.Value)

select input
Scan while !eof()
  scatter memvar
  select output
  replace Output.Name with (lcName)
  select input

well,  thats basically it, but that replaces Output.Name with "F1"  instead of the contents of Input.F1.

Thanks in advance



RE: Passing Variables


I though about doing a textmerge to a .prg file and then calling that program, but that seems like the hard way to do it.....

RE: Passing Variables

If I am understanding correctly, try:

variable = ThisForm.txtName.name
REPLACE (variable) WITH ALLTRIM(ThisForm.txtName.Value)

ThisForm.txtName.Name must be the same name as the table field though.

Dave S.

RE: Passing Variables

try expanding the variable by using the amphresand in front of the variable name

replace Output.Name with (&lcName)

this will be the equivalent of this:

replace Output.Name with (F1)

hope this what you were asking and it helps you with your problem


RE: Passing Variables

The condition in the SCAN ENDSCAN being WHILE !EOF() is redundand and can be left out !!
SCAN ENDSCAN automatically scan throught the records and stops with the last record. Leaving out the condition will speed things up.

You store the value of your textbox in a variable.

if your variable would be "TestValue"

Your replace statement would be:

REPLACE myField WITH "TestValue", so if your variable would be:

MyVariable = "TestValue"

YOur replace statement would be:

REPLACE myField WITH MyVariable

leaving out the brackets !!.


Weedz (Wietze Veld)
My private project:www.crowncap.demon.nl\info\crwnbase
Download the CrownBase source code !!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close