General discussion

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

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.


Discussion is locked
Reply to: MS Access - Date()-1 and Time Between 8:00am and 9:30PM
PLEASE NOTE: Do not post advertisements, offensive materials, profanity, or personal attacks. Please remember to be considerate of other members. If you are new to the CNET Forums, please read our CNET Forums FAQ. All submitted content is subject to our Terms of Use.
Reporting: 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

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

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

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

Thank you so much Kees! It works! =)

- Collapse -
(NT) You're welcome. Thanks for letting us know.

CNET Forums