Date in criteria expression

  • Thread starter Thread starter RipperT
  • Start date Start date
R

RipperT

The following is giving me an error message "data type mismatch in criteria
expression":

If Not IsNull(DLookup("ClassDate", "tblSCC", "([ClassDate] = '" & .ClassDate
& "')")) Then...

Is there something tricky about a date field that I don't know about?

Rip
 
The following is giving me an error message "data type mismatch in criteria
expression":

If Not IsNull(DLookup("ClassDate", "tblSCC", "([ClassDate] = '" & .ClassDate
& "')")) Then...

Is there something tricky about a date field that I don't know about?

Rip

Hopefully the dot (& .ClassDat) is not a part of the actual control
name.

Dates must be surrounded with the date delimiter symbol #.

If Not IsNull(DLookup("ClassDate", "tblSCC", "[ClassDate] = #" &
[ClassDate] & "#")) Then...
 
I'm not an expert like some of the posters in this group, but I believe you
need to use # delimiters around date data types. You might try;

If Not IsNull(DLookup("ClassDate", "tblSCC", "([ClassDate] = '" & "#" &
..ClassDate
& "#" & "')")) Then...

HTH
 
Back
Top