Enter date range in a form then run query

K

karaeloko

Hi all,

How can I stop a query from running when I open the form and asking me
for the start and end date, so that I can enter the date range in a
form then click a button to run the query?
 
A

Allen Browne

Presumaby this problem occurs because the form is bound to the query.

Remove the criteria from the query. Instead, apply a Filter to the form when
the date fields are chosen.

This takes a bit of code. Here's a comprehensive example:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

Or here's a simple example that just handles the dates:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html
Although this example talks about opening a report, the code for the filter
is identical. Instead of the OpenReport, you use:
Me.Filter = strWhere
Me.FilterOn = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top