View Full Version : Refer to Subform control in Query


sluggercoach
12-18-2008, 09:38 AM
I am about to go crazy! I have something that I know should be easy that I cannot get to work. I have an application that has a form with several subforms on it. The user opens the forms and I need to be able to allow them to view a report to show more details about what they selected in the form. So, my query needs to use a control on one of the subforms as criteria. For the life of me I cannot get it to work. I have tried it every way I can and nothing. What is the correct syntax to use a control from a subform as criteria in a query?

frmDCNNavigator is my main form. frmDCN# is the subform I am interested in. DCN# is the control whose value I want to be my criteria.
I have tried:
forms!frmDCNNavigator!frmDCN#!DCN#
and forms!frmDCNNavigator!frmDCN#.form![DCN]
etc., etc.

pbaldy
12-18-2008, 09:49 AM
Here's a handy reference on syntax:

http://www.mvps.org/access/forms/frm0031.htm

with that inadvisable symbol in the names, you will need to bracket them.

Mike375
12-18-2008, 09:53 AM
This works for me

[Forms]![Masterform]![SPP]![CoverageType]

With [SPP] being the subform and [CoverageType] being the field in the subform.

What I am using displays all the records for the underlying table where the entry in CoverageType is the same as the record on the subform.


If I did not use [ ] then they will add in themselves. Perhaps your field name having # is not helping.

I am using A2003.