Results 1 to 3 of 3
  1. #1
    maxis is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2013
    Posts
    27

    Running AUTOEXEC after holding down the Shift Key - Function runs multiple times?

    I bring up the database (Access 2003 / XP) by holding down the shift-key. As designed, the shift-key by-passes running the autoexec macro automatically. I then run the autoexec macro with the vba code viewer up so I can F8 down through all the code. The autoexec macro is one statement - RUNCODE which executes a vba FUNCTION Startup(). Everything seems to work great, but when the function goes to EXIT FUNCTION I assumed it's completed. BUT the next F8 GOES TO THE Startup() FUNCTION again and runs through the code over and over.

    I don't think it does this when the program actually runs normally (don't by-pass the autoexec), but I'm struggling to understand why it's running the function over and over again when I'm F8'ing through the code.

    Is it something peculiar with the AUTOEXEC in MS ACCESS? Can I trust that it really does ONLY RUN ONE TIME?



  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,288
    When the code runs automatically, it stops when it executes the line "EXIT FUNCTION" and returns to the autoexec macro.

    On the other hand, if the cursor is still in the autoexec macro and you press the F8 key, the code starts again. Does the same thing to me when I am stepping through the code.
    The difference is that the code knows to stop when it reaches "EXIT FUNCTION". You (and I) keep pressing the F8 key, which re-executes the macro which calls the function.

    Solution: Stop pressing the F8 key after the "EXIT FUNCTION" line returns you back to the autoexec macro (the yellow hi-light goes away when the code stops)
    ........ unless you want to run the function again.
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  3. #3
    maxis is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2013
    Posts
    27
    That was funny! Just needed to confirm I wasn't really going crazy! Thank you so much! Feel much better now!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 07-11-2013, 07:05 AM
  2. Access AutoExec Macro Cannot Find Function
    By JuanTooTree in forum Access
    Replies: 3
    Last Post: 03-14-2013, 08:52 AM
  3. Replies: 3
    Last Post: 01-08-2013, 11:51 AM
  4. Form_Current() running multiple times
    By caddcop in forum Forms
    Replies: 0
    Last Post: 04-01-2011, 09:00 AM
  5. Replies: 5
    Last Post: 12-10-2009, 10:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums - Senior Forums