How To Run A Function When You Open The Database – AutoExec

I don’t normally use macros, but here is one you may find useful.

The AutoExec macro.

If you call the macro “AutoExec”, it will run whenever someone opens the database.

Pretty nice huh?

So in this example, I want the “VBAInputBoxCancel” (Function) to run whenever I open the database.

If you recall, I used this as a sub procedure back in this post, but as a “sub procedure”.

Normally a function returns a value, and a sub procedure does something, but this could do either, so I just called it a sub.

Anyway, all that needed to be done, is change the “sub procedure” into a “function”, and Access was able to identify it.

So now, whenever the database is loaded the “VBAInputBoxCancel” function runs.

Let me know if you have any questions.

Offsite Related Information:

“Go Fund Me” Page


($5 suggested amount)

(…10% of your gift amount will go to charity)

Free! Subscribe To Our YouTube Channel!

Free MS Access VBA Programming Course

Facebooktwitterredditpinterestlinkedinmailby feather
Tags: ,