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)
 
Back
Top