Solved

Problem with date range in a query

Posted on 2011-02-24
2
407 Views
Last Modified: 2012-08-13
I have a form with two fields... txtStart and txtEnd.  Then in my query syntax I have...
Between Forms!frmMainMenu!txtStart and Forms!frmMainMenu!txtEnd

If I enter today's date in both fields I get 10 returns returned with today's date.  But if I enter today's date as the start date and tomorrow's date as the end date I get more records that contain today's date and some with tomorrow's date.  Why am I not seeing all of today's records when I enter today's date in both fields?

--Steve
0
Comment
Question by:SteveL13
  • 2
2 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 34969493
your date field contains time values, check this out.

to get around this, you need to add a day in your date range

Between Forms!frmMainMenu!txtStart and Dateadd("d",1, Forms!frmMainMenu!txtEnd)

or use

DateValue([DateField] Between Forms!frmMainMenu!txtStart and Forms!frmMainMenu!txtEnd
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34969498
or use

DateValue([DateField]) Between Forms!frmMainMenu!txtStart and Forms!frmMainMenu!txtEnd
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now