By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Filter between dates and times in a query

100+
P: 120
Expand|Select|Wrap|Line Numbers
  1. (((Format([DateEntered],"yyyymmdd"))=Format(Now()-1,"yyyymmdd")) And ((Format([DateEntered],"Short Time"))>="08:00" And (Format([DateEntered],"Short Time"))<="21:30"))
[DateEntered] is a field in my table that is auto set when they enter data to the table using Now().

The above filter works from what I can tell, but I want to enter the dates and times manually.

I usually use "Between [Start Date,(mm/dd/yyyy)] And [End Date,(mm/dd/yyyy)]"

How would I include the time? Which I also want to enter manually using Enter Parameter Value.
2 Weeks Ago #1

✓ answered by NeoPa

I think perhaps you're overcomplicating things still, but here's all you have to change :
Expand|Select|Wrap|Line Numbers
  1. Between [Start Date/Time (mm/dd/yyyy hh:mm)] And [End Date/Time (mm/dd/yyyy hh:mm)]
It's only the prompt itself that changes. The operator thus enters a single Date/Time value formatted as shown.

Share this Question
Share on Google+
5 Replies


NeoPa
Expert Mod 15k+
P: 31,308
Why not prompt them for values that include times?

That simplifies the whole thing. Remember KISS!
2 Weeks Ago #2

100+
P: 120
I know how to prompt for dates("Between [Start Date,(mm/dd/yyyy)] And [End Date,(mm/dd/yyyy)]"), but not dates with times? The above code was the only thing I could find...I googled but could not find what I wa looking for. That's why I asked here. I have to be fairly close.
2 Weeks Ago #3

NeoPa
Expert Mod 15k+
P: 31,308
I think perhaps you're overcomplicating things still, but here's all you have to change :
Expand|Select|Wrap|Line Numbers
  1. Between [Start Date/Time (mm/dd/yyyy hh:mm)] And [End Date/Time (mm/dd/yyyy hh:mm)]
It's only the prompt itself that changes. The operator thus enters a single Date/Time value formatted as shown.
2 Weeks Ago #4

100+
P: 120
NeoPa you are absolutely 100% correct. Was totally overthinking it. I was thinking you had to do it seperate.

Thanks a million.
2 Weeks Ago #5

NeoPa
Expert Mod 15k+
P: 31,308
A pleasure DJ. Sometimes you just can't see the wood for the trees.
1 Week Ago #6

Post your reply

Sign in to post your reply or Sign up for a free account.