SubformReference.mdb ( Beginner ) |
Post Reply |
Author | |
Roger Carlson
Microsoft MVP Joined: 20 Feb 2008 Status: Offline Points: 261 |
Post Options
Thanks(0)
Posted: 21 Jul 2008 at 10:50pm |
Please consider donating $1 per sample downloaded, find out why here.
SubformReference.mdb This sample illustrates how to reference controls on subforms and subsubForms. It also illustrates how to set the focus to these controls. The problem with referencing controls on subforms is usually with the naming and which controls you are referencing. You never reference the actual subform name, you reference the name of the control which holds the subform. So let me use some more generic names:
"Form1" has a control on it "SubControl1" which holds "Subform1". This subform has a control on it called "SubsubControl1" which holds subform "Subsubform1", which has a control on it called "txtAmount" So we have a form, with a subform which holds a subform. The command to reference the text box on the bottom-most form would be: Forms!Form1!subControl1.Form!subsubControl1.Form!txtAmount Notice, at no time do I refer the name of either subform, just the controls which hold them. Now this gets confusing, because Access has a tendency to name the control the same as the subform. This is why I always name the control something other than the name of the subform to avoid confusion. To set the Focus to a control on a subform, you must first set focus to the Control on the main form which holds the subform and then the control on the subform. DownloadAccess 97 (27 KB): uploads/5/SubformReference97.zip Access 2000 (48 KB): uploads/5/SubformReference2k.zip |
|
|
|
Sponsored Links | Want a good read? Try The Summer of His Life (available on Amazon!) |
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |