Format Date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to be able to format the date for my query that asks a user to enter a
date. The date is stored a date/time field. I want my users to only enter the
date and not the time. The data is captured and stored as a date/time field
in the database table. Here is my user prompt. [PLEASE ENTER DATE] Here is
how the date is stored in the table "01/09/2004 1:35:47 PM" . I want the
query to strip off the time.
 
Try using the DateValue function to remove the time

Select DateField From TableName Where DateValue(DateField) = [Please Enter
Date]
 
Use the DateValue function on the stored field.

Field: DateOnly: DateValue(YourDateField)
Criteria: CDate([Please Enter Date])
 
If I understand your question correctly, you wantthe user to enter a date
value and the Query will select all records for that date regardless of the
time associated with the date in the Record, the you can use the following
in the criteria row of the DateFieldColumn in your Query grid:
= [PLEASE ENTER DATE] And < ([PLEASE ENTER DATE] + 1)

--
HTH
Van T. Dinh
MVP (Access)



Michael Kaendera said:
I want to be able to format the date for my query that asks a user to enter
a
date. The date is stored a date/time field. I want my users to only enter
the
date and not the time. The data is captured and stored as a date/time
field
in the database table. Here is my user prompt. [PLEASE ENTER DATE] Here is
how the date is stored in the table "01/09/2004 1:35:47 PM" . I want the
query to strip off the time.
 
Back
Top