Dlookup Run-time error '3464' - Data type mismatch in criteria expression

waseem0888

Member
Local time
Today, 21:23
Joined
Jul 25, 2020
Messages
51
I am trying to Dlookup and getting the following error Run-time error '3464' - Data type mismatch in criteria expression

Me.Description = DLookup("[Description]", "qryRFIA", "[ID]='" & Me.rDocNo & "'")

can someone tell me what is the issue in the above line?
 
You either have single quotes when the data is numeric, or not when it is a string.
I would have thought ID would be numeric?
 
You either have single quotes when the data is numeric, or not when it is a string.
I would have thought ID would be numeric?
Yes Id is numeric and RDocNo is combo with numeric and laphabet mix values i have tried this one Me!Description = DLookup("[Description]", "qryRFIA", "[ID]=" & Me!rDocNo) but iwas getting Run-time error '2471'
 
And 2471 is?

How do you expect to compare a numeric with numeric/alpha string? :unsure:
 
And 2471 is?

How do you expect to compare a numeric with numeric/alpha string? :unsure:
This is the 2471 error i have used the same code line in another form it was working fine but here it gives such an error.
dlookup.jpg
 
And that
This is the 2471 error i have used the same code line in another form it was working fine but here it gives such an error.View attachment 87452
And that form might well have different structure.?

What is the value of Me.rDocNo ?

What are sample values in ID?, I would expect that to be the autonumber field as that is what Access defaults to?

Put the criteria into a string strCriteria and Debug.Print that and post it back. Then use that in the Dlookup.
 
And that

And that form might well have different structure.?

What is the value of Me.rDocNo ?

What are sample values in ID?, I would expect that to be the autonumber field as that is what Access defaults to?

Put the criteria into a string strCriteria and Debug.Print that and post it back. Then use that in the Dlookup.
Form structure is almost the same as this form. The values in combo name is a mixture of numeric and alphabetic values like CW-418-0009 and SE-418-0071 etc... Yes, the values in the ID is access default auto number.
 
So how do you expect to compare an ID like 23 or whatever to CW-418-0009 :unsure:

Bit like saying 'find me an orange that looks like this banana' :(

Post back the code from the form that 'is supposed to work'
 
What is the bound column of the combo? Is it the ID (as it should be with ID field bound and hidden and DocNumber displayed in the combo)? Could it be that the combo's on the two form are different?

Cheers,
Vlad
 

Users who are viewing this thread

Back
Top Bottom