Refer to form using variable

LB79

Registered User.
Local time
Today, 09:47
Joined
Oct 26, 2007
Messages
505
Hello,

Im trying to refer to a control on a form partly using a variable.
I want the variable to contain the form name as per below:

Path = "[Forms]![frm_NCT_sub2]!"
Path [AT_txt1].BackColor = 16761281
So when put togather should end up as
[Forms]![frm_NCT_sub2]![AT_txt1].BackColor = 16761281

BUT I get a compile error (expected procedure not variable).
Is there any way to do this?

Thanks
 
The syntax to use a variable as a form name (and a control name too just for your knowledge) would be:

Forms(strVariable).Controls(strControlVariable).PropertyOrMethodHere = "xxxxx"
 

Users who are viewing this thread

Back
Top Bottom