Print Page | Close Window

SubformReference.mdb ( Beginner )

Printed From: Roger's Access Library
Category: Roger's Access Library
Forum Name: Roger's Download Samples
Forum Description: A compendium of Microsoft Access 97 and 2000+ routines, each separated into its own sample database.
Printed Date: 12 Jul 2020 at 2:32am
Software Version: Web Wiz Forums 12.03 -

Topic: SubformReference.mdb ( Beginner )
Posted By: Roger Carlson
Subject: SubformReference.mdb ( Beginner )
Date Posted: 21 Jul 2008 at 10:50pm

Please consider donating $1 per sample downloaded, - find out why here .


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:


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.

Access 97 (27 KB): - uploads/5/
Access 2000 (48 KB): - uploads/5/

Consider donating $1 per sample downloaded," rel="nofollow - find out why here .<

Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 -
Copyright ©2001-2019 Web Wiz Ltd. -