Date/Time Formatting

S

Scott

I have a date field in a retail sql database that has the following format
8/31/07 3:21:00 AM
8/31/07 9:25:00 AM
8/31/07 2:22:00 PM
8/31/07 3:21:00 AM
8/31/07 10:21:00 AM
8/31/07 5:58:00 AM
I enter the date portion of the field in a form and want to in a query
extract all times between 6:00 AM AND 12:00 PM. I've tried the criteria
=[Forms]![Date]![CurrentPeriodBeginningDate] & "" & #6:00:00 AM" AND
<=[Forms]![Date]![CurrentPeriodBeginningDate] & "" & #12:00:00 PM" but it is
too complex to be evaluated. How do I query the records with times between 6
AM and 12 PM with the date in a form?

Thanks,
Scott
 
D

Douglas J. Steele

Between CDate([Forms]![Date]![CurrentPeriodBeginningDate]) + TimeSerial(6,
0, 0) AND
CDate([Forms]![Date]![CurrentPeriodBeginningDate]) + TimeSerial(11, 59, 59)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Scott said:
I have a date field in a retail sql database that has the following format
8/31/07 3:21:00 AM
8/31/07 9:25:00 AM
8/31/07 2:22:00 PM
8/31/07 3:21:00 AM
8/31/07 10:21:00 AM
8/31/07 5:58:00 AM
I enter the date portion of the field in a form and want to in a query
extract all times between 6:00 AM AND 12:00 PM. I've tried the criteria
=[Forms]![Date]![CurrentPeriodBeginningDate] & "" & #6:00:00 AM" AND
<=[Forms]![Date]![CurrentPeriodBeginningDate] & "" & #12:00:00 PM" but it
is
too complex to be evaluated. How do I query the records with times
between 6
AM and 12 PM with the date in a form?

Thanks,
Scott
 
S

Scott

Just what I was looking for, thank you!

Scott

Douglas J. Steele said:
Between CDate([Forms]![Date]![CurrentPeriodBeginningDate]) + TimeSerial(6,
0, 0) AND
CDate([Forms]![Date]![CurrentPeriodBeginningDate]) + TimeSerial(11, 59, 59)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Scott said:
I have a date field in a retail sql database that has the following format
8/31/07 3:21:00 AM
8/31/07 9:25:00 AM
8/31/07 2:22:00 PM
8/31/07 3:21:00 AM
8/31/07 10:21:00 AM
8/31/07 5:58:00 AM
I enter the date portion of the field in a form and want to in a query
extract all times between 6:00 AM AND 12:00 PM. I've tried the criteria
=[Forms]![Date]![CurrentPeriodBeginningDate] & "" & #6:00:00 AM" AND
<=[Forms]![Date]![CurrentPeriodBeginningDate] & "" & #12:00:00 PM" but it
is
too complex to be evaluated. How do I query the records with times
between 6
AM and 12 PM with the date in a form?

Thanks,
Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top