DCount and Parameters

st3ve

Registered User.
Local time
Today, 18:48
Joined
Jan 22, 2002
Messages
75
I am using DCount to 'grab' a value resulting from running a query.

If DCount("[PassCodeResult]", "[PassCodeQuery]",[PassCodeResult]="Fail") > 0 Then ....etc

PassCodeQuery's SQL is :
SELECT [Enter Passcode1] AS PassCodeResult
FROM Table1;

Works fine, but my query needs to contain parameters eg [Enter Passcode1]. When I include a Parameter in the underlying query, I get a message saying ...

"The expression you entered as a query parameter produced this error: MyDatabaseName can't find the name 'Enter Passcode1' you entered in the expression." when the DCount function executes.

If I replace the Parameters in the query with simple text, all works OK. (NB.Query does work 'on its own' with the parameter).

Any ideas?

Thanks.
 
Code:
If DCount("[PassCodeResult]", "[PassCodeQuery]", "[PassCodeResult]=""Fail""") > 0 Then
 
Thanks both, but I have just re-tried your suggestions (plus a number of other variants) and still get the message:

"The expression you entered as a query parameter produced this error: MyDatabaseName can't find the name 'Enter Passcode1' you entered in the expression."
 
Parameters

Is it actually permitted/posssible to use parameters in the query which Dmax/Dcount references?

Does my problem come down to how the [Parameters] are delimited , in some way?

Any further ideas greatly appreciated.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom