Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query part of date

Status
Not open for further replies.

696796

Programmer
Aug 3, 2004
218
GB
I want a pop up box to appear for the user, so they can type in the year of a date.

I have this which doesn't work

DatePart("yyyy",[OrderDate])

the format of my date in the table is

26/07/2002

I just want to search on the year basically.

Any ideas??

Thanks
 
Where do you want the popup box to appear?

If you are using a query and would like it to generate a popup box asking for the year, you could use ["Enter year"] in the criteria section for the OrderDate field.

Does that answer the question, or were you trying to do something else?
 
Something like this ?
WHERE Year([OrderDate]) = [Enter Year]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
The thing is I just want the user to enter the year i.e. "2002" as apposed to 16/06/2002
 
Why don't you create an expression field, for example:
ExprYear: DatePart("yyyy",[OrderDate])

Then enter the criteria for ExprYear as ["Enter date"]

Would that work?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top