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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,995
Messages
5,834,777
Members
430,321
Latest member
yemisimi11

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
Top