Run macro for each record in a query

L

Les Isaacs

Hello All

I have a table [practices], which contains details of 'client
organisations'. From time to time I need to send an email to certain 'client
organisations'. I have a macro called 'send_emails' which uses the
SendObject command, which I use to send the emails (a button on a form runs
the macro). The emails include a report that is specific to the 'client
organisation'. Currently I select the 'client organisation' with a combobox,
run the macro, select another 'client organisation', run the macro again,
etc. etc.

It would be extremely useful if I could avoid having to select each 'client
organisation' manually. I would like instead to have a query
'qry_client_organisation_for_email' which would select all the 'client
organisation's that are to receive the email (I can easily create this
query), and then have some code that runs the macro 'send_emails' for each
record in 'qry_client_organisation_for_email'. I am sure this can be done,
but I don't know the syntax for it!

Hope someone can help.
Many thanks
Leslie Isaacs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top