How to execute a module in MS access when the access file is open

  • Thread starter Thread starter Dominique Ighedosa
  • Start date Start date
D

Dominique Ighedosa

Hello,
I need some help. How would you automatically execute a
module in MS access when a user opens the access file?
My email address is (e-mail address removed).

Regards,

Dom
 
Dom:

Create a macro and use the OpenModule command to reference
both your module and the functions that you wish to run.
You will have to reference each function separately with
successive commands. Name the macro AutoExec.

When you start up the Access application, the AutoExec
macro will automatically start and execute the OpenModule
commands.

Steve
 
Steve, thanks for your speedy response. I did exactly what
you said but the module doesn't execute the code. When I
open the access file, it opens my Module but it doesn't
execute the code. Can you please help.
In addition, how can I close the Access file once the
module is done exectuing?
 
Dominique said:
I need some help. How would you automatically execute a
module in MS access when a user opens the access file?

You don't execute a module, you execute a procedure in a
module.

One way to run code when the database opens is to create a
macro named AutoExec and add one line to the macro using the
RunCode action with the name of the function that you want
to execute. Note that the procedure must be a Public
Function in a standard module.
 
Hey Marshall, thank you very much for your response. It
worked fine. Have a great day!
 
Dominique said:
Hey Marshall, thank you very much for your response. It
worked fine. Have a great day!

Glad to be able to help. You have a great day too.
--
Marsh
MVP [MS Access]

 
Back
Top