Read control info from other form

Edwinq

Registered User.
Local time
Today, 03:36
Joined
Apr 8, 2010
Messages
25
Hi,
I'd like to read a label on another form.
I thought it would be easy to just read
controls(Forms!form!subform!label1)
gives me an error the control does not exist.

any help would be appreciated.
edwin
 
Hi,
I'd like to read a label on another form.
I thought it would be easy to just read
controls(Forms!form!subform!label1)
gives me an error the control does not exist.

any help would be appreciated.
edwin

If I understand your question you have two forms open and want to read the value of a control on one of those forms. Below, may be a partial solution for you. It returns the value contained in the control, not the name of the control. Additionally if it is a label you would need to retrieve the caption property.

Code:
SomeValueForm1= Forms("Form2").Controls("text30")

However, if you have a form/subform set-up follow the advice of pbaldy.
 
Also, labels don't have values. You need to read the .Caption property if you are really dealing with a label.
 

Users who are viewing this thread

Back
Top Bottom