Dlookup Run-time error '3464' - Data type mismatch in criteria expression (1 Viewer)

waseem0888

Member
Local time
Today, 21:37
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?
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:37
Joined
Sep 21, 2011
Messages
14,265
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?
 

waseem0888

Member
Local time
Today, 21:37
Joined
Jul 25, 2020
Messages
51
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'
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:37
Joined
Sep 21, 2011
Messages
14,265
And 2471 is?

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

waseem0888

Member
Local time
Today, 21:37
Joined
Jul 25, 2020
Messages
51
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:37
Joined
Sep 21, 2011
Messages
14,265
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.
 

waseem0888

Member
Local time
Today, 21:37
Joined
Jul 25, 2020
Messages
51
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.
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:37
Joined
Sep 21, 2011
Messages
14,265
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'
 

bastanu

AWF VIP
Local time
Today, 13:37
Joined
Apr 13, 2010
Messages
1,402
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

Top Bottom