Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use a literal variable to refer to a form field?

Status
Not open for further replies.

planix

Technical User
Dec 3, 2002
22
Hi,

I am not sure of the terminology to be able to ask this question sensibly. So, if I am not clear please ask questions.

I have label on a form into which I programmatically put some text from another table.

The text is the name of fields underlying the form. As the user interacts with the form the text in this label changes depending on where the user is in answering some questions.

I want to be able to use the text to refer to the field so that I can change the value of the field.

For example, on of the fields is called [A01]. I can obviously change the value by using

Me.A01= x(whatever value)

But I want to be able to change the value of the field that corresponds with the text in the label.

For example, if the label reads "A01" I want to be able to set the underlying field A01 by using the labels caption property to refer to the field.

I know this is an issue with referencing the object model and I think it may not be possible to do what I want. But, if someone knows of a way of doing this could you let me know. If there is no way to do it please let me know as well so I can work on a different approach.

Thanks very much.

 
Would you believe I found out just 2 minutes after asking this how to do it?

Wierd!

Anyway the answer is to use;

Me(var)

to refer to the field.

Per my example;

Me(lblQNum.caption)=1

works really well.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top