Solved

Problem with date range in a query

Posted on 2011-02-24
2
415 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

786 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