DCount

G

Guest

I want use the DCount function but I am having problems with criteria
expression. When I run the code, it keeps telling me there is "data mismatch
in the criteria expression". [Days to Complete] is a field where the data
type is Number. int1 is an integer but I have also made it string.
[ESDStaffName] is a field where the data type is Text. strStaffName is
string. Do I have to change the field [Days to Complete] to a different
data type? Any help is appreciated. Thank you.

intSameDay = DCount("[ID]", "PM Date Errors Asc", "[Days to Complete] ='" &
int1 & "' And [ESDStaffName] = " & "'" & strStaffName & "'")
 
D

Duane Hookom

Try:
intSameDay = DCount("[ID]", "PM Date Errors Asc", "[Days to Complete] =" &
int1 & " And [ESDStaffName] = """ & strStaffName & """")
 
K

kingston via AccessMonster.com

Try this:

intSameDay = DCount("[ID]", "PM Date Errors Asc", "[Days to Complete] =" &
int1 & " And [ESDStaffName] = '" & strStaffName & "'")

Make sure int1 is a number or use CLng(int1) instead.
I want use the DCount function but I am having problems with criteria
expression. When I run the code, it keeps telling me there is "data mismatch
in the criteria expression". [Days to Complete] is a field where the data
type is Number. int1 is an integer but I have also made it string.
[ESDStaffName] is a field where the data type is Text. strStaffName is
string. Do I have to change the field [Days to Complete] to a different
data type? Any help is appreciated. Thank you.

intSameDay = DCount("[ID]", "PM Date Errors Asc", "[Days to Complete] ='" &
int1 & "' And [ESDStaffName] = " & "'" & strStaffName & "'")
 

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

Top