locked
كيف يمكن الاستغناء عن Autoexec ؟ RRS feed

  • Question

  • كيف يمكن الاستغناء عن Autoexec لفتح نموذج محدد فى الاكسيس فى بدايه التشغيل بكود vba

    ان امكن ارفاق مثال كتطبيق عملى له وشكرا

    Sunday, December 1, 2019 6:01 PM

All replies

  • We speak English in this forum. Please write in English, or find a forum for your language.

    -Tom. Microsoft Access MVP

    Sunday, December 1, 2019 6:35 PM
  • I apologize for not being proficient in English
    How to do without Autoexec to open a specific model in Access at the beginning of operation with vba code

    If possible attach an example as a practical application to him. Thank you
    Sunday, December 1, 2019 7:55 PM
  • Select the ACCESS file in the directory and then SHIFT + ENTER. It will open without any Autoexec code running.
    Monday, December 2, 2019 12:17 AM
  • Select the ACCESS file in the directory and then SHIFT + ENTER. It will open without any Autoexec code running.

    This is not what I mean
    I want to open the database without using Autoexec
    I want a VBA module
    if it is possible

    If possible attach an example as a practical application to him. Thank you

    Monday, December 2, 2019 5:32 PM
  • There is no built in feature to run VBA code directly on start-up.

    However, it is VERY easy to have code run on start-up – you have two choices:

    #1

    Set the application to launch a form on start-up. Thus this form can run code. I suppose it could display something, run the code and then the form can close.

    So you can simply put a call to your VBA routines in the on-load event of that start-up form.

    #2

    The other way is to use the autoexec, and the first line of the autoexec can then call your VBA code – you would thus only need one command in the autoexec:

    Use the macro command :RunCode

    You can then specify a standard VBA function in a standard code module to run. At that point, this VBA function can run some VBA code, or even call many or several subs and functions that will run (and thus run on application start-up).

    So there is no setting in Access that will run some code in a standard VBA module, but between the above two choices, it is rather easy to have access run some VBA code in standard code modules.

    So, your choices are limited to the start-up form, or the autoxec (and you can even have both run code if you wish).

    So, while macors are VERY limited compared to VBA code, then it is a simple matter to have an autoexec macro with ONE line of code, and that one line macro can call your VBA code, and thus you achieve the same goal.

    So it is easy to have your application run VBA code on start-up but you ARE LIMITED to autoexec or the start-up form you choose to achieve this goal.

    Regards,

    Albert D. Kallal (Access MVP 2003-2017)

    Edmonton, Alberta Canada


    Monday, December 2, 2019 7:15 PM
  • Thank you
    I'm sorry that I couldn't show you what I want. Thank you
    Monday, December 2, 2019 7:59 PM