By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,930 Members | 1,383 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,930 IT Pros & Developers. It's quick & easy.

Help - AutoExec not running my Function

P: n/a
I can't seem to get AutoExec to run a function. Per an article on this
group, I:
1) built a boolean function in a module that simply issues a MsgBox,
then returns True
2) in AutoExec macro, I wrote a condition "onOpen()=False" including
the dbl quotes. For the action I put out another MsgBox saying 'onOp is
False'.

The 2nd MsgBox always appears. I put a breakpoint in the function. It
never triggered, so my function is not being called.

Help - what is wrong. This is so simple.

DIck Penny

Jul 18 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a

dick wrote:
I can't seem to get AutoExec to run a function. Per an article on this
group, I:
1) built a boolean function in a module that simply issues a MsgBox,
then returns True
2) in AutoExec macro, I wrote a condition "onOpen()=False" including
the dbl quotes. For the action I put out another MsgBox saying 'onOp is
False'.

The 2nd MsgBox always appears. I put a breakpoint in the function. It
never triggered, so my function is not being called.

Help - what is wrong. This is so simple.

DIck Penny
What exactly are you trying to make happen? or what did you expect to
happen?
What is OnOp? Where is it located - in a form? a module?

I slapped up a quick function, and called it in an AutoExec macro, and
it worked fine.

Public Function fShowMsg()
fShowMsg = MsgBox("Did you see this?", vbYesNo)
If fShowMsg = vbYes Then
MsgBox "You answered Yes", vbOKOnly
End If
End Function

the autoexec macro is just
RunCode fShowMsg

Jul 18 '06 #2

P: n/a

pi********@hotmail.com wrote:
dick wrote:
I can't seem to get AutoExec to run a function. Per an article on this
group, I:
1) built a boolean function in a module that simply issues a MsgBox,
then returns True
2) in AutoExec macro, I wrote a condition "onOpen()=False" including
the dbl quotes. For the action I put out another MsgBox saying 'onOp is
False'.

The 2nd MsgBox always appears. I put a breakpoint in the function. It
never triggered, so my function is not being called.

Help - what is wrong. This is so simple.

DIck Penny

What exactly are you trying to make happen? or what did you expect to
happen?
What is OnOp? Where is it located - in a form? a module?

I slapped up a quick function, and called it in an AutoExec macro, and
it worked fine.

Public Function fShowMsg()
fShowMsg = MsgBox("Did you see this?", vbYesNo)
If fShowMsg = vbYes Then
MsgBox "You answered Yes", vbOKOnly
End If
End Function

the autoexec macro is just
RunCode fShowMsg
Jul 18 '06 #3

P: n/a
What exactly are you trying to make happen? or what did you expect to
happen?
What is OnOp? Where is it located - in a form? a module?
A prior post in this group said not to use RunCode......, but rather to
use a conditional macro as the AutoExec, the condition being for me
"onOpen()=False" where onOpen() is a public function that I wrote and
placed in a module. From my breakpoints and MsgBoxs, it seems clear to
me that onOpen() is never being called/executed.

Dick

Jul 18 '06 #4

P: n/a
post the code for OnOpen function

(BTW, that's not a great name for a macro, since all forms an reports
have an OnOpen event.)

Jul 18 '06 #5

P: n/a
(BTW, that's not a great name for a macro, since all forms an reports
have an OnOpen event.)
Thanks for that TIP, I have changed it.

I took your advice and called my onOpen() via a RunCode - IT WORKS
FINE.

No idea why the "conditional" did not work.

Thanks.

Dick

Jul 18 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.