Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Dec 2002
    Location
    Bruges, Belgium
    Posts
    122
    Thanks
    14
    Thanked 2 Times in 2 Posts

    Run VBA macro at Database Open (2003)

    Is it possible to run a Macro (VBA Sub routine) when the Database is Opened? I'm not looking for a Form- or Report open event, but something akin to excel's Workbook Open event.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Run VBA macro at Database Open (2003)

    You can create a macro (in the Macros section of the database window) and name it AutoExec. This will cause it to be run when the database is opened.
    To run VBA code from a macro, use the RunCode action.

  3. #3
    2 Star Lounger
    Join Date
    Dec 2002
    Location
    Bruges, Belgium
    Posts
    122
    Thanks
    14
    Thanked 2 Times in 2 Posts

    Re: Run VBA macro at Database Open (2003)

    Sorry for the delay in replying, but I had to figure out that you can't run a SUB directly. And when that was cleared I stumbled on forgotten parenthesis upon the function's call!
    (The function has no arguments)

    But finally, it worked. Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •