Dmax criteria not working but should be (1 Viewer)

arage

Registered User.
Local time
Today, 05:07
Joined
Dec 30, 2000
Messages
537
I defined a long integer field in my table & then set a globalField in a standard module as Long also. Then I set up a Dmax function using the two fields but I get an error that the criter has mismatched data types. Can someone recommend why this is?

x = DMax("eventnumber", "testqry", "regionaldirectorcode= '" & glblDirCode & "'")

regionaldirectorcode is a long integer in the table definition
glblDirCode is a Long in the standard module

“error is 3464 The criteria expression in a Find method is attempting to compare a field with a value whose data type does not match the field’s data type.”
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 00:07
Joined
Feb 19, 2002
Messages
43,302
You need to remove the quotes from around glbDirCode. Quotes are only used to surround string variables.

x = DMax("eventnumber", "testqry", "regionaldirectorcode= " & glblDirCode)
 

Users who are viewing this thread

Top Bottom