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.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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
 
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,835
Members
449,192
Latest member
mcgeeaudrey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top