Using MS Access/Parameter query


Hello Scott!
Back once again.
I am trying to filter a date range for a report in Access 2010.
Using a simple parameter query I can enter the start date in the window when requested and then the end date in the next window. I recall seeing somewhere that I can achieve the same result by simply entering the start date and end date in a single window. My understanding is that this method involves the use of an unbound form and a couple of text boxes together with some VBA programming. I cannot seem to get around this though.
Perhaps you could help please.

Yes, but no VBA is involved. This works because you can reference a value in any control on an open form using the syntax:


So you create a form, leave it unbound (call it frmDateRange). Then add 2 text boxes (name them txtStart and txtEnd). Then add a button to run the report. In the query that is the Recordsource of the report, set the criteria to:

BETWEEN Forms!frmDateRange!txtStart AND Forms!frmDateRange!txtEnd

The report will be filtered for that range.

One trick I use is to set the Default Property for the text boxes to:

DMin("[datefield]","queryname")  and DMax("[datefield]","queryname") for txtStart and txeEnd respectively. This way the user can get the full report if they don't want to filter it.

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

©2017 All rights reserved.