Type Mismatch

D

DS

I'm receiving a type mismatch error on this DCount. All fields are numbers.

TxtNo = Nz(DCount("PDItemID", "tblPrintDetails", "tblPrintDetails.PDCheckID
= " & Forms!frmOrderScreen!TxtCheckID And "tblPrintDetails.PDItemID = 1"),
0)

Any help appreciated,
Thanks
DS
 
D

Douglas J. Steele

The keyword And needs to be inside the quotes.

TxtNo = Nz(DCount("PDItemID", "tblPrintDetails", "tblPrintDetails.PDCheckID
= " & Forms!frmOrderScreen!TxtCheckID & " And tblPrintDetails.PDItemID =
1"), 0)

That assumes PDCheckID is a numeric field. If it's text, you'll need quotes
around the value:

TxtNo = Nz(DCount("PDItemID", "tblPrintDetails", "tblPrintDetails.PDCheckID
= '" & Forms!frmOrderScreen!TxtCheckID & "' And tblPrintDetails.PDItemID =
1"), 0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Code Is Slow 3
Code Is Slow 6
Loop Problem 5
Line Break 9
UNION Error 9
RECORDSET 2
Union Query Format 6
DLookUp Syntax 5

Top