none
Restarting Access RRS feed

  • Question

  • Noob in Access forms and VBA.

    The project I'm working on starts up with a menu on a form.

    When I start Access with the Shift key down, I can access the tables and code.

    Right now, after I make changes, I have to shut everything down and restart Access to test. Then shut it down again and restart to make another change. This makes for a terrible long debugging cycle.

    How do I change modes without restarting every time?

    Thursday, May 9, 2019 3:01 PM

Answers

  • Pros don't use a startup form but an AutoExec macro that uses the RunCode action to run a public function in a standard module (I call mine InitApplication). Then anytime I want to restart, I go to the Immediate window and enter InitApplication, or I double-click the AutoExec object in the Nav Pane.

    -Tom. Microsoft Access MVP

    • Marked as answer by B White Thursday, May 9, 2019 5:19 PM
    Thursday, May 9, 2019 3:16 PM

All replies

  • Pros don't use a startup form but an AutoExec macro that uses the RunCode action to run a public function in a standard module (I call mine InitApplication). Then anytime I want to restart, I go to the Immediate window and enter InitApplication, or I double-click the AutoExec object in the Nav Pane.

    -Tom. Microsoft Access MVP

    • Marked as answer by B White Thursday, May 9, 2019 5:19 PM
    Thursday, May 9, 2019 3:16 PM
  • Thanks Tom, that worked.

    I found "RunStartup" but couldn't get it to run in immediate or RunMacro.

    RunStartup is executed by Dialog_Login and I can run that. This lets me go back and forth.

    Thursday, May 9, 2019 5:22 PM
  • Pros don't use a startup form but an AutoExec macro that uses the RunCode action to run a public function in a standard module

    Hi Tom,

    Interesting! What are the advantages of a macro over a form, and/or the disadvantages of a form compared to a macro?

    Imb.

    Thursday, May 9, 2019 8:33 PM
  • For one: you get to restart :-)

    For another: you may decide in your startup code you don't even want to open the first form. Maybe the version of Access is not supported, or the check for valid license failed, or the back-end database is not where it was last time, or …


    -Tom. Microsoft Access MVP


    Thursday, May 9, 2019 9:28 PM
  • No question, that one will often exit, and re-start the application to see how it runs as "user mode".

    There can and no doubt can be a HUGE LONG list of things that you have set on startup. What form, the application wide ribbon. Allow special keys - quite a long list of things that get in your way to develop.

    So, try this cool trick:

    Put a C+R button (compact + repair) in your QAT.

    Now, after writing some code, modify a form, I want to test as user mode? Well, in some cases, I can just launch the form, but OFTEN you have so many things occurring  on startup, you often reach a point where a LOT of your application requires your startup code to run.

    So, now, with the ONE button on the QAT?

    I just do one click. The app does a c+r (good anyway - you do that 20 times a day anyway during heavy development). So, with ONE simple click, your app now re-starts as "user mode".

    And to flip back to developer mode? One click on that QAT, but hold down the shift key.

    So, no question this shift key developer dance will occur all day long, but now you can flip with just ONE mouse click.

    Depending on the level of lock down, some of my apps hide the QAT when  you allow startup code, settings, and the startup form to launch.

    In this case? Well, ok, at least WHILE in developer mode (shift key into app to develop), I can do as I please, and then whack the C+R button. (I often don't even save the form changes I am in - one mouse click and it asks me to save - hit ok - and app re-starts - so this flip from dev mode to test/user mode is STILL only one button.

    Ok, for the case in whick I can't use the QAT?

    Well, you hit alt-f4, or simple close the application. (or exit however you have to) Now, in the windows file explore, your application (file) should still be highlighed. So, a quick tap on the enter key (and hold down shift) gets you back in. So the flip can still be quite quick.

    So, the above quite much outlines how I deal with this. I too over time have gravitated to using the autoexec, but the OTHER gazillion things such as use special keys, ribbon, and a BIG long line of startup settings in Access are STILL required to be disabled for you the developer to work. So, this QAT, and the file explore trick works quite well.

    So, while I use autoexec, it still does not resolve the VERY long list of startup settings I have in the options for startup. So, this shift in/out dance still occurs a lot for me.

    Regards,

    Albert D. Kallal (Access MVP 2003-2017)

    Edmonton, Alberta Canada


    Friday, May 10, 2019 6:54 AM