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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datepart Function????

Status
Not open for further replies.

fatz09

MIS
May 19, 2003
30
0
0
GB
I am creating a parameter query. I need the parameter to ask for the date (mm/dd/yyyy) and the time (12:15am) of a dateTime field. Any suggestions.

Thanks for the help.

Fatz09
 
How is your parameter query any different than any other parameter query?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
If you want both date and time parts for the same field in your table then you can do it in a single parameter. For example
Code:
PARAMETERS [Enter Date and Time] Date;

Select ...

From ...

Where DateField <= [Enter Date and Time]

and you just enter "04/25/2005 12:15AM" for the parameter value.
 
What if I just want the time of date time field.

Thanks.
 
PARAMETERS [Enter start time] DateTime, [Enter end time] DateTime;
SELECT ...
WHERE TimeValue(Format([DateTime field],'hh:nn:ss')) Between [Enter start time] And [Enter end time]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top