Date Expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to add criteria to a query field so that the only records shown are
those for which 14 days have past from a date in a specific field. The
expression I am using keeps giving me a type mismatch error. How can I
arrange this expression to work properly:

CDate(DateAdd("d",14,"Date Field")) >= Date()
 
Dear Candace:

A reference to a column name, except for certain special functions, would
not be in double quotes. Since yours contains a space, put it in square
brackets:

DateAdd("d",14,[Date Field]) >= Date()

DateAdd returns a date, so you don't need to convert it with CDate().

Does this help?

Tom Ellison
 
Perhaps the space in the field name is causing a problem. Adding the square
brackets may help.

CDate(DateAdd("d",14,"[Date Field]")) >= Date()

FWIW, you can simplify this greatly with

WHERE [Date Field] + 14 >= Date()
 
Back
Top