Refer to Subform Control in Query

sluggercoach

Registered User.
Local time
Today, 01:12
Joined
Jun 12, 2007
Messages
21
Hi. I have a form that has a sub-form on it. I am trying to refer to a field on the subform from within a query. Basically when you click on a check box on the sub-form I am trying to then open another form asking for a password. So the query has to know which record you are on, on the sub-form. Everything works fine when I run this from within the subform directly but when I try to run this through the subform with the main form open, the query doesn't know which field I am referring to on the subform. How do I refer to a sub-form field/control in a query when going through a main form?
 
A foolproof way of getting this refrences right is to use the wizzard. If you have your form open while you are working with your query, place the cursor in the criteriarow and click on the wizzardtool on the toolline. (looks like a wizzard wand) Now select Forms -> Loaded Forms and find the field you want to refrence, click ok and Access sets the correct refrence for you.

Should look something like this:
Forms!Nameof Form!NameofSubform.Form.NameOfControl
JR
 

Users who are viewing this thread

Back
Top Bottom