Setting Variables in Macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Ok few thigs to start with:
I am using Access 2003
I have little to no experience with VB so if I can do this using the
design window it is over my head.

Question
I have 2 querries looking at 2 tables for the same criteria. In this
case the limiting criteria is obtained by prompting the user for a beginning
and ending date. Is it possible to make a macro that executes both these
querries but sets the parameters with only 1 set of prompts? Right now when
I run the macro it runs the first query and prompts me for the dates, then it
runs the second query and prompts me for the dates again as I will be adding
more querries that require the same inputs I was hoping to simplify the users
job by only haveing to input the dates once. Again as i am not fuent with
VB if this can't be done using the macro design screen I am out of luck.
thanks in advance
 
Jedi,

The best approach here is to not use a Parameter Query. Instead, put a
couple of unbound textboxes on a form which will be open at the time
that the queries are required. The user can enter the dates in these
textboxes. Then, in the Criteria of the date field in your queries,
enter the equivalent of this...
Between [Forms]!NameOfYourForm]![NameOfStartDateTextbox] And
[Forms]!NameOfYourForm]![NameOfEndDateTextbox]
 
OK Thanks. A little confusing to me (still new to access and sql) but I will
power through it.

Steve Schapel said:
Jedi,

The best approach here is to not use a Parameter Query. Instead, put a
couple of unbound textboxes on a form which will be open at the time
that the queries are required. The user can enter the dates in these
textboxes. Then, in the Criteria of the date field in your queries,
enter the equivalent of this...
Between [Forms]!NameOfYourForm]![NameOfStartDateTextbox] And
[Forms]!NameOfYourForm]![NameOfEndDateTextbox]

--
Steve Schapel, Microsoft Access MVP

PowerPoint said:
Ok few thigs to start with:
I am using Access 2003
I have little to no experience with VB so if I can do this using the
design window it is over my head.

Question
I have 2 querries looking at 2 tables for the same criteria. In this
case the limiting criteria is obtained by prompting the user for a beginning
and ending date. Is it possible to make a macro that executes both these
querries but sets the parameters with only 1 set of prompts? Right now when
I run the macro it runs the first query and prompts me for the dates, then it
runs the second query and prompts me for the dates again as I will be adding
more querries that require the same inputs I was hoping to simplify the users
job by only haveing to input the dates once. Again as i am not fuent with
VB if this can't be done using the macro design screen I am out of luck.
thanks in advance
 
Back
Top