Command button - Trigger one of Two Macros

G

Guest

Sorry for the bad Subject. Hopefully I can better explain my issue here. I
have ONE command button to launch a query. But depending on the time of month
and which month we are in will determine which query is ran. For example, the
date is today, 5/11/07, the query will retrieve all records for the past 3
months including current month, May April and March. Come June 1st thru June
7th, I want the query to retrieve May, April and March but after June 7th,
June, May and April. the queries are built, I am looking to create one
command button so there is no confusion to the user. The process should be
transparent to the user. Hope this makes sense.
 
D

Damon Heron

If I understand you right, there are two queries (or more?) that are
retrieve records for various periods. One query retrieves records for the
three months, MarAprMay, and the second AprMayJune. If that is the case???,
then in the click event:

If Date > #5/10/2007# And Date < #6/7/2007# Then
DoCmd.OpenQuery "query1"
Else
DoCmd.OpenQuery "query2"
End If

However, what happens after those periods? do u have queries for all the
months of the year? If so, then you might want to use Select Case instead
of a series of if then statements.

HTH
Damon
 

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