Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop to run a macro for each value

Status
Not open for further replies.

blutimus

IS-IT--Management
Joined
Dec 20, 2004
Messages
18
Location
US
hello

i hve a macro 'macro1' which i normally call from a form. the form passes a value 'cust_id' from the customer table. the macro runs several queries which use cust_id as a parameter, makes a table with the results, then calls a function which transfers the table to a spreadsheet. then i go back to the form and enter a new cust_id, and run the macro again until i have a spreadsheet for every cust_id. how do i run the macro once for each cust_id in the customer table?

i appreciate any ideas.

blute

 
Convert the macro to VBA and browse the form's recordset.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
hi

thanks for the reply and suggestion.

i neglected to mention (sorry) i'm not too hip with the programming... how do i do that?

b

 
wow, that was easy.

now how do i 'browse the form's recordset'?

thanks for the prompt effective reply.

blute
 
blutimus,

Look at Zion7's Dec 21 reply at this link..


That is a simple example. You will need to insert your converted VB (from macro) in the loop (of course your table names, etc. etc. etc.).

Just trying to point you in the right direction.

I hope this helps..

Good Luck...
 
now how do i 'browse the form's recordset'
Do a keyword search in this forum for browse recordset or browsing recordset.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top