*/*/&[What year do you want?] (1 Viewer)

Gordon

Gordon
Local time
Today, 10:28
Joined
Nov 25, 1999
Messages
34
I'm trying to set up a parameter for a query which would allow the end user to type in a year, and have it show all occurances for the year.

I've tried the following syntax, which does not work.....

Like "*/*/&[what is year?]

Any suggestions for the correct syntax on this?

Thanks!


Gordon
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:28
Joined
Feb 19, 2002
Messages
43,257
Like works with strings. Despite what your eyes tell you, a date is not a string. Dates are stored as double precision numbers with the integer portion representing the number of days since Dec 30, 1899 and the decimal portion represents the time of day.

If you want to extract a part of a date, use either the DatePart() function or the specific Year(), Month(), Day() functions.
 

Gordon

Gordon
Local time
Today, 10:28
Joined
Nov 25, 1999
Messages
34
DATEYEAR: DatePart("yyyy",[Date])

Thanks - I ended up using the syntax DATEYEAR: DatePart("yyyy",[Date]) and putting the parameter [What Year do you want?] in the criteria. This worked.

Gordon
 

Users who are viewing this thread

Top Bottom