I want to run some code at startup when I open the db.
I created a new function and tried RunCode Myfunction() in a macro but that returns it can't find the function name. I tried with other functions which I know work and get the same error.
I want to run some code at startup when I open the db.
I created a new function and tried RunCode Myfunction() in a macro but that returns it can't find the function name. I tried with other functions which I know work and get the same error.
Two ways to go about this:
1. Create an AutoExec macro (see: https://support.office.com/en-us/art...8-a4755e548124)
2. Set a Startup Form (a form that automatically opens when the database is opened), and put VBA code in the On Load event of that form.
See: https://support.office.com/en-us/art...c-e5d5adbff1df
and https://docs.microsoft.com/en-us/off...cess.form.load
I usually opt for the second method, as VBA gives you more flexibility than Macros.
Functions are in a general module?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
The AutoExec is where I wanted to go, I already have it and wanted to add to it. Currently it's running queries but I wanted to add code. I thought about just calling a form but did not know how to run the code with on open so I'll do that then, thanks.