Datepart Function

  • Thread starter Michael Kaendera
  • Start date
M

Michael Kaendera

I wanted to know if you can use the datepart function in a query to extract a
date such as 08/01/2005 from a date/time field such as 08/01/2005 10:55 . I
have a query that asks users for to input a date. The users have to input the
both the date and time since this is the way the data is captured and stored
the table. I want the users to only input a date without the time. I was
thinkng of using the datapart function but did not know if it would work.
 
A

Allen Browne

Use DateValue() to strip off the time (or TimeValue() to strip off the
date.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:[email protected]...
 
O

Ofer

You can use
Where Format(MyDateField,"dd/mm/yyyy") = format([Enter date
here:],"dd/mm/yyyy")

If you use a beween criteria you'll have to covert it to date
Where cvdate(Format(MyDateField,"dd/mm/yyyy") between cvdate(format([Enter
Start date here:],"dd/mm/yyyy")) and cvdate(format([Enter End date
here:],"dd/mm/yyyy"))
 
Top