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

Problem with querying a datefield

Status
Not open for further replies.

marcin2k

Programmer
Jan 26, 2005
62
CA
I have a query which has a field with a date (date type field). In the criteria I have put this statement:
<=[Forms]![fForm1]![EndDate]
EndDate is a calendar function.

The problem is: For example if I pick the end date to be August 31st, 2005. It displays everything find except it does not display one record which it should.
This record has the following date: 8/31/2005 8:28:22 AM

anyone have any idea why it does not display this date eventhough it matches the query criteria?

Thanks any help would be awsome
 
I have noticed that if I just use =[Forms]![fForm1]![EndDate] it does not even display all results with the same date but displays all records instead
 

If this 8/31/2005 is in the text box then this is the real thing 8/31/2005 12:00:00 AM which is < 8/31/2005 8:28:22 AM

So try : Int([FieldName])<=Int([Forms]![fForm1]![EndDate])

So the integer part of a datetime field is the date and the fractional part is the time!
Take a look here
Why do Dates and Times seem to be so much trouble?
faq68-5827
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top