Calling a Sub from a Macro

G

Guest

In Access 2003, is it possible to call a Sub from a macro? I know you can
call a Function, but I am not passing any information. In my macro, I run 4
queries. Query 1 clears a table that will receive the final data.Qquery 2
updates a date field for all records in a second table. Query 3 inserts all
records from table 2 into final table. Query 4 selects records from a 3rd
table meeting a date matched on current month and inserts them into the final
table. As part of this macro, I would like to be able to call a Sub to
process through all records in the final table against a table containing
company holidays. I need to check the records in the final table to make sure
the date is not a company holiday or a Saturday or Sunday. I have the 4
queries and have written a couple of Subs to process the recordsets, but I do
not know how to call the leading Sub to start the process. I know there is a
RunCode Action in the macro, but this will only call out to a function. I am
not passing any values in either direction. My end result will be to dump the
final table to a Report as part of the same macro. Is there a way to call a
Sub from the macro? Do I have to create a Function to call out to the Sub?
PLEASE HELP!!!!!!

Thanks in Advance for your help
Kenny A.
 
S

Steve Schapel

Kenny,

Just name the Sub as a Public Function, and you will be able to use in
via a RunCode action in your macro. It doesn't matter that it doesn't
return a value.
 
G

Guest

Steve,
Thanks for your help. This site have been such a great help in my
developmet of my Access Applications.

Thanks again
Kenny
 

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