You are here:

Using MS Access/Parameter query form - Date range


Hi Scott

I know how to create a parameter query in access but I know you have a much neater solution with an unbound form containing two text boxes and a command button and using VBA.

Unfortunately, I cannot recall how to go about it and I have mislaid my documentation that you provided previously. I know that if you enter only the start date and click, then you get all records from that date in the report; if you enter only the end date and click, then you get all records up till that date ; and if you simply click the button you get all records.

Could you kindly refresh my memory in this regard?


Any value in an Open form can be referenced using the syntax:


The way I generally do it is with 2 unbound textboxes on an unbound form. The Default values for these these textboxes are set as:

DMin("[datefield]","tablename")  for txtStart and
DMax("[datefield]","tablename") for txtEnd

the criteria int he query is set to:

BETWEEN forms!formname!txtStart AND Forms!formname!txtEnd

So if the user doesn't change anything they get all the records. If they only change the start date then they get records from that date. If te only change the end date they get records up to that date. If they change both dates they get records between the entered dates.

Hope this helps,
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Using MS Access

All Answers

Answers by Expert:

Ask Experts




I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.


I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Brooklyn College BA

©2016 All rights reserved.