Run At Startup - Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know this has been asked before, and I have searched google and found many references to the auto exec macro, but still this doesn't work. The code below is what I have to turn off the menu bar

Function RemoveMenuBarPuhlease(
DoCmd.ShowToolbar "Menu Bar", acToolbarN
End Functio

Now how do I make it run when the database starts. I have created a macro called AutoExec, and called this function, but that doesn't seem to work. Is the naming of that macro case sensitive. What can I do here, in excel it was a simple auto_open, what do I do in Access

Thanks
 
I think you're confusing ACCESS macros with other Office macros. Other
Office macros are VBA code; ACCESS macros are not.

Go to the Macros objects in database window. Create a macro that does what
you want to have happen when the database starts up. Name this macro
Autoexec and save it.

When you open the database, this macro will run.

If you want VBA code to run as part of the startup, put that code in a
public function, and then have the Autoexec macro do a RunCode action with
the name of that function as the argument.

--

Ken Snell
<MS ACCESS MVP>

David Kane said:
I know this has been asked before, and I have searched google and found
many references to the auto exec macro, but still this doesn't work. The
code below is what I have to turn off the menu bar.
Function RemoveMenuBarPuhlease()
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
End Function

Now how do I make it run when the database starts. I have created a macro
called AutoExec, and called this function, but that doesn't seem to work.
Is the naming of that macro case sensitive. What can I do here, in excel it
was a simple auto_open, what do I do in Access.
 
In the AutoExec Macro, use the RunCode action and specify
the fn as the argument.

You can place the focus in the argument row and use
the "Build" button (with 3 dots) just to the right to
navigate to the fn.

Your function works fine (tested in AXP).

HTH
Van T. Dinh
MVP (Access)


-----Original Message-----
I know this has been asked before, and I have searched
google and found many references to the auto exec macro,
but still this doesn't work. The code below is what I
have to turn off the menu bar.
Function RemoveMenuBarPuhlease()
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
End Function

Now how do I make it run when the database starts. I
have created a macro called AutoExec, and called this
function, but that doesn't seem to work. Is the naming of
that macro case sensitive. What can I do here, in excel
it was a simple auto_open, what do I do in Access.
 
In design view there is a "Startup" selection available
on the "Tools" menu - it allows you to designate various
startup choices - I'm not sure if it allows you to run
VBA code directly, but you could open a form that runs
code to remove the tool bar on the "form open" event and
then close the form with code.
-----Original Message-----
I know this has been asked before, and I have searched
google and found many references to the auto exec macro,
but still this doesn't work. The code below is what I
have to turn off the menu bar.
Function RemoveMenuBarPuhlease()
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
End Function

Now how do I make it run when the database starts. I
have created a macro called AutoExec, and called this
function, but that doesn't seem to work. Is the naming
of that macro case sensitive. What can I do here, in
excel it was a simple auto_open, what do I do in Access.
 
Back
Top