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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to handle subform references in code

Status
Not open for further replies.

lastout

Programmer
Apr 12, 2002
84
US
I have three related questions:

1. When you open a form that contains a subform, does Access consider the subform "open" as well, I mean in the sense that it goes through the load and open procedures?

2. If you open a form that contains a subform, how do you refer to that subform to do simple things like set the focus to a particular control? I would think you just say forms!mysubformname!mycontrolname, BUT when I do this, I keep getting error messages telling me that Access couldn't find my subform. I'm just guessing that this is because Access isn't considering my subform to be 'formally' (excuse the pun) opened, hence question number 1.

3. Am I on the wrong track? (aside: ahhhyyyyeeee) lastout (the game's not over till it's over)
 
I'd urge you to have a squizz at MSDN and the Access Help file to check on the order of event firing. As I recollect, the subform load before the main form, but don't quote me.

The syntax for referring to a subform's controls from a main form is:
Me!subFormControlOnMainFormName.Form!controlOnSubformName.

For a handy reference, have a look at Dev Ashish's web site http:\\ - there's a page there you should print out and keep that details subform references. (You should bookmark the site anyhow - it's a benchmark for Access development. When you can find legitimate faults on Dev's site, then you're an Access developer!) Andrew Webster MCSD

Sequence Information Technology
 
Have AccessWeb bookmarked already but didn't check there first. Thanks -- as always, good advice! lastout (the game's not over till it's over)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top