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

Date/Time query filter

Status
Not open for further replies.

blubomber

MIS
Dec 27, 2001
241
US
i am trying to pull information from a table according to a date entered by the user. the colum in the table is a Date/time setup with the date being mm/dd/yyyy and the time being hh:mm:ss AM/PM. I want the user to type in just he date needed and pull all the info from that day. In my query i have [Enter Date - mm/dd/yyyy] as the criteria for the Date colum. When i run the query, i dont get any data back even though i know it is there because i have the table open. Do i need to put in something in the criteria to have it look at all the times before midnight?

Thank you for any help with this.
 
If your filter is of the form

Where dtfield = #[Enter Date - mm/dd/yyyy]#

and your fields have non-zero fractional parts (i.e. hours, minutes, seconds) then the only ones that will match are those where the hh:mm:ss are exactly zero (midnight).

Instead try

Where cDate(Int(dtfield)) = #[Enter Date - mm/dd/yyyy]#
 
Thank you for the reply Golom.

I did what you suggested and it still does not work. I am using access 2000 and trying to write a query to extract data by a date that the user inputs. the Field is a date/time.

Thanks again for your assistance
 
And this ?
WHERE CLng(dtfield) = CLng([Enter Date - mm/dd/yyyy])

Set the parameter's type to DateTime.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV, i tried your example and access does not like it. gives me an error saying the ecpression is typed in correctly or is too complex to be evaluated.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top