Full Version: Referencing Sub Form Controls
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
MVarner
I have a database with a main form "Order Entry" and one sub form "flights". I am attempting to set the properties of controls on the sub form during the subforms load event.

When the form loads I get an error that says the control either doesn't exist or the name is misspelled. I can run the same code from a command button on the subforms but I can't getting to work using the load event.

I know it has something to do with the way I am referencing the controls but I can't work it out. I am looking for an example of code to change the properties of a control on a subform using the load or on current event.


Marshall
MVarner
FYI. I am using Access 2007.

Marshall
Alan_G
Hi

Have a look here for the correct syntax for referencing forms/subforms (and reports). Depending on what you're doing you may need to put your code in the main forms load or open event and not the subs
MVarner
I have tried using every option from the info you sent me and nothing works in Access 2007. I created a new DB in access 2010 and used the subform load event to change properties on a control on the subform and it works fine in Access 2010. But when I open it in Access 2007 the error says the control is missing or mispelled. I am attaching the sample I created for anyone who can help to see.

Alan_G
Hi

Just FYI there's no attachment to your post. Attachments need to be zipped and less than 2meg before uploading
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.