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

Query date field with date & time

Status
Not open for further replies.

netrusher

Technical User
Joined
Feb 13, 2005
Messages
952
Location
US
When querying for data and the date fields have Date & Time is there a way to ignore the time and have the
query just find info based on the date and not the time?
 
Check out DatePart in Access help.

Alcohol and calculus don't mix, so don't drink and derive.
 
One way is to use the FORMAT() function on the field.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
I have been searching and cannot find an example of what
you mean. Please show me an example if you can!
 
For Format, a simple example is:
Code:
Format([mydate], "yyyymmdd")
Hope that helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
HarleyQuinn,

Thanks for your help. I am using the GuardTime Field to query
for a date such as 12/10/07.

How and where do I use your example in the query?

Where is currently in the field is 12/10/2007 01:26:37 PM

I only want to query on the 12/10/2007 part.
 




Date/Time values are NUMBERS. The DATE is the integral part of the number and the TIME is the fractional part.
Code:
Dim dTheDate as Date, sTheDate as string
dTheDate = CLng([GuardTime])
sTheDate = Format([GuardTime],"yyyy/mm/dd")
NOTE: the Format function returns a STRING representation of the date and NOT a REAL DATE value.


Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top