Auto Execute Macro when opening a form

  • Thread starter Bill_Green via AccessMonster.com
  • Start date
B

Bill_Green via AccessMonster.com

Hello,
I'd like for a macro to kick off when a form is opened and I'm having issues.
In Excel it would be the Auto_Open command, but in reading the posts here it
looks like in Access it's AutoExec. Is this correct? Regardless, I can't get
it to work. To be short if I wanted to make Option Button 467 True upon
opening I have this (I know I simply change the default on the option group,
I'm just wanting to learn how to do this and keep the post short):

Sub AutoExec()
Option467 = 2
End Sub

I appreciate the help.
 
R

Roger Carlson

No. The AutoExec macro is a macro that will fire when you open Access.

To run a macro when you open a form, do as Danny suggests: open the Form in
design mode and go the properties. Go to the On Open event and select your
macro from the drop-down list.

Be advised, however, that Access has a bunch of different events: On Load,
On Open, On Activate, On Got Focus, On Current... that fire at slightly
different times. You may need to move your macro to a different event if it
doesn't act as expected.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 

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