Short Trip: Neither of the following work as a Control Source for an unbound text box. What am I doing wrong?
The following DLookup runs but gives a #Name? error:
=Nz(DLookUp("ACMinQuant","dttblAcceptanceCriteria" ,(("RepositoryID = " & "[Forms]![frm02EnterTestData]![RepositoryID]") AND ("MeasAttribute = "FlowRateLPMaxcc"))))
The following SQL, which is a copy and paste from a query, does not run in the Control Source and gives a "The syntax of the subquery in tis expression in incorrect." error:
SELECT dttblAcceptanceCriteria.RepositoryID, dttblAcceptanceCriteria.MeasAttribute, dttblAcceptanceCriteria.ACMinQuant
FROM dttblAcceptanceCriteria
WHERE (((dttblAcceptanceCriteria.RepositoryID)=[Forms]![frm02EnterTestData]![RepositoryID]) AND ((dttblAcceptanceCriteria.MeasAttribute)="FlowRate LPMaxcc"));
Scenic View: On a form, I'm using an unbound text box to hold a number. The number is extracted from dttblAcceptanceCriteria:
MEASATTRIBUTE ... ACMINQUANT ... ACMAXQUANT ... REPOSITORYID
FlowRateLPMaxcc .. 7.2 .................. 30 ................... 184
FlowRateUPMaxcc .. 6.2 .................. 25 ................... 184
I first tried the following DLookup. It runs, but the result is #Name? and not 7.2. The function doesn't like the AND ~~~~
=Nz(DLookUp("ACMinQuant","dttblAcceptanceCriteria" ,(("RepositoryID = " & "[Forms]![frm02EnterTestData]![RepositoryID]") AND ("MeasAttribute = "FlowRateLPMaxcc"))))
So, I tried SQL code. I built the code in a query, which runs. But, when I copy the SELECT statement into the Control Source, the following pithy error message pops up:
The syntax of the subquery in this expression incorrect.
SELECT dttblAcceptanceCriteria.RepositoryID, dttblAcceptanceCriteria.MeasAttribute, dttblAcceptanceCriteria.ACMinQuant
FROM dttblAcceptanceCriteria
WHERE (((dttblAcceptanceCriteria.RepositoryID)=[Forms]![frm02EnterTestData]![RepositoryID]) AND ((dttblAcceptanceCriteria.MeasAttribute)="FlowRate LPMaxcc"));
What am I doing wrong?