Query Based on Main and SubForm ID Fields Not Working

  • Thread starter Thread starter Wayne
  • Start date Start date
W

Wayne

I’m trying to create a query that will show me only the records that
match the current ID fields on the frmTest and subform frmTestSub.
I’ve tried several entries in the Criteria field but the testSubID
keeps popping up the “Enter Parameter Value.” What do I have to type
in the TestSubID field to get the query to work correctly?

Here is the SQL view:

SELECT tblTest.TestID, tblTest.Name, tblTestSub.TestSubID,
tblTestSub.TestID, tblTestSub.Auto
FROM tblTest INNER JOIN tblTestSub ON tblTest.TestID =
tblTestSub.TestID
WHERE (((tblTest.TestID)=[Forms]![frmTest]![txtTestID]) AND
((tblTestSub.TestSubID)=[Forms]![frmTestSub]![txtTestSubID]));
 
Wayne said:
I’m trying to create a query that will show me only the records that
match the current ID fields on the frmTest and subform frmTestSub.
I’ve tried several entries in the Criteria field but the testSubID
keeps popping up the “Enter Parameter Value.” What do I have to type
in the TestSubID field to get the query to work correctly?

Here is the SQL view:

SELECT tblTest.TestID, tblTest.Name, tblTestSub.TestSubID,
tblTestSub.TestID, tblTestSub.Auto
FROM tblTest INNER JOIN tblTestSub ON tblTest.TestID =
tblTestSub.TestID
WHERE (((tblTest.TestID)=[Forms]![frmTest]![txtTestID]) AND
((tblTestSub.TestSubID)=[Forms]![frmTestSub]![txtTestSubID]));


When referencing a control/field in a subform, you need to
go through the main form and its subform control.

tblTestSub.TestSubID)=Forms!frmTest!frmTestSub!txtTestSubID

Note that frmTestSub in the above is the name of the subform
**control** on the main form. The name of the control might
or might not be the same as the name of the form object that
is displayed in the subform control.
 
Wayne said:
I’m trying to create a query that will show me only the records that
match the current ID fields on the frmTest and subform frmTestSub.
I’ve tried several entries in the Criteria field but the testSubID
keeps popping up the “Enter Parameter Value.”  What do I have to type
in the TestSubID field to get the query to work correctly?
Here is the SQL view:
SELECT tblTest.TestID, tblTest.Name, tblTestSub.TestSubID,
tblTestSub.TestID, tblTestSub.Auto
FROM tblTest INNER JOIN tblTestSub ON tblTest.TestID =
tblTestSub.TestID
WHERE (((tblTest.TestID)=[Forms]![frmTest]![txtTestID]) AND
((tblTestSub.TestSubID)=[Forms]![frmTestSub]![txtTestSubID]));

When referencing a control/field in a subform, you need to
go through the main form and its subform control.

tblTestSub.TestSubID)=Forms!frmTest!frmTestSub!txtTestSubID

Note that frmTestSub in the above is the name of the subform
**control** on the main form.  The name of the control might
or might not be the same as the name of the form object that
is displayed in the subform control.

Works great! Thanks Marsh.
 
Back
Top