Macro running mult queries - use user input throughout??

tjharlan

Board Regular
Joined
May 8, 2004
Messages
63
Hello,

I'm running an Access macro that is running about 15 queries consecutively. About 5 of those queries use two variables that the user must input. The two variables are consistant for all the queries. In other words, var1 and var2 would be the same for each of the queries in the macro. Thus, rather than have the user enter the same variables over and over, I'd like to be able to set the variable once (beginning of macro via user input) and use that input throughout the running of each subsequent query.

Any ideas?

Thanks for the time.

Rgds,
T.J.
 

Some videos you may like

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

nullZero

Active Member
Joined
Nov 14, 2005
Messages
497
First create a form with two textboxes to capture the variables and then add a command button to the form that launches the macro

Then change your 15 queries to use the form fields as criteria instead of user input
 

Watch MrExcel Video

Forum statistics

Threads
1,118,086
Messages
5,570,136
Members
412,305
Latest member
Mozz
Top