Office & Productivity Software forum

General discussion

MS Access - Date()-1 and Time Between 8:00am and 9:30PM

by sheilasabado / April 13, 2010 8:36 PM PDT

Hi everyone, I hope someone can help me with this problem. I have a table where I upload an SMDR file for the previous day at 12:05AM. In this table I have a field named Call Start. I would want to do a query in access which gets the Calls for yesterday's date between 8:00am and 9:30pm only. I am having a very difficult time with this.


Post a reply
Discussion is locked
You are posting a reply to: MS Access - Date()-1 and Time Between 8:00am and 9:30PM
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: MS Access - Date()-1 and Time Between 8:00am and 9:30PM
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Re: selection
by Kees Bakker / April 14, 2010 5:30 PM PDT

It's not really important where the data comes from. It's important how it's stored in the database. Is it one field with Date/Time format? Or 2 with text format? Or ...?

And can you tell what your difficulty is? What did you try and didn't work yet?


Collapse -
re: selection
by sheilasabado / April 17, 2010 8:03 PM PDT
In reply to: Re: selection

Hi Kees, thanks for the reply.

1. Date/Time format - General Date
2. I have tried putting:

>Date()-1 and Between #8:00:00 AM# and #9:30:00 PM#

But it won't work. I hope you can help me with this.

Collapse -
Re: selection on date time
by Kees Bakker / April 17, 2010 8:34 PM PDT
In reply to: re: selection

To select all fields from Table1 with the selection you specified based on field dt in that table I used the following SQL-statement (that's another word for a query).
FROM Tabel1
WHERE (((Format([dt],"yyyymmdd"))=Format(Now()-1,"yyyymmdd")) AND ((Format([dt],"hh:mm"))>="08:00" And (Format([dt],"hh:mm"))<="21:30"));

The trick, as you see, is to convert the relevant parts of the date to strings.


Collapse -
re: se
by sheilasabado / April 17, 2010 9:17 PM PDT

Thank you so much Kees! It works! =)

Collapse -
(NT) You're welcome. Thanks for letting us know.
by Kees Bakker / April 17, 2010 10:44 PM PDT
In reply to: re: se
Popular Forums
Computer Help 49,613 discussions
Computer Newbies 10,349 discussions
Laptops 19,436 discussions
Security 30,426 discussions
TVs & Home Theaters 20,308 discussions
Windows 10 360 discussions
Phones 15,802 discussions
Windows 7 7,351 discussions
Networking & Wireless 14,641 discussions


CNET bought a house!

Take a look inside the house where we will be testing connected locks, thermostats and other smart home products so we can tell a complete story.