Type Mismatch

  • Thread starter Thread starter DS
  • Start date Start date
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
 
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
RECORDSET 2
DLookUp Syntax 5
Is This Good? 13
DCount Date Problem 5
Union Query Format 6

Back
Top