Changing a macro's filter from a form button

jclu

Registered User.
Local time
Yesterday, 19:21
Joined
Jul 18, 2007
Messages
18
Hi, I have a macro that runs a report using the OpenReport action, and has as the Where condition to display only the entries for today's date. I also have a form with a button that when clicked, runs this macro. The problem is that, while most of the time when this macro is run the filter for the report should be to only show today's entries (from the underlying query), there are times when I need to show the entries from a previous date. Currently I go in and manually change the Where condition.

What I'm wondering is if it's possible to have the button on the form specify the Where condition of the macro? That way I could have two buttons on the form - one for showing today's entries, and another one for showing 'backdated' entries. I could also create a second macro similiar to the first one, except that the Where condition displays entries based on user input of the date, and link the second button to this second macro. But is it possible to only have one macro, and have the buttons on the form change the Where condition as needed? Thanks for the help.
 
You could pick up the date from an unbound field on your form which defaults to todays date but you could then change that if you want to look at a previous day.
 
So in the Where condition of the macro, I could put something like [Query].[Date_Field]=[Form].[Date_Field]?
 
I guess so but I never use macros. Always use VBA because its easier for me
 

Users who are viewing this thread

Back
Top Bottom