Connecting Tech Pros Worldwide Forums | Help | Site Map

Help - AutoExec not running my Function

dick
Guest
 
Posts: n/a
#1: Jul 18 '06
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


pietlinden@hotmail.com
Guest
 
Posts: n/a
#2: Jul 18 '06

re: Help - AutoExec not running my Function



dick wrote:
Quote:
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

dick
Guest
 
Posts: n/a
#3: Jul 18 '06

re: Help - AutoExec not running my Function



pietlinden@hotmail.com wrote:
Quote:
dick wrote:
Quote:
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
dick
Guest
 
Posts: n/a
#4: Jul 18 '06

re: Help - AutoExec not running my Function


Quote:
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

pietlinden@hotmail.com
Guest
 
Posts: n/a
#5: Jul 18 '06

re: Help - AutoExec not running my Function


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.)

dick
Guest
 
Posts: n/a
#6: Jul 19 '06

re: Help - AutoExec not running my Function


Quote:
(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

Closed Thread