Solved

Problem with date range in a query

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

837 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