2015年3月22日 星期日

Auto Run Access Form using AutoExec

This tutorial explains how to auto run Access Form using AutoExec Macro.


Auto Run Access Form


Access can auto run any Objects, while Access Form is the most popular Object to auto run, this tutorial will cover mainly auto run Form.


AutoExec is a reserved name for Macro, indicating that this Macro will run when Access is opened, we can make use of it to auto run any Procedure in Access.


You may also want to consider Windows Task Scheduler to auto open an Access and then execute Procedure using autoexec. Click the below link to read more about Windows Task Scheduler.


Auto Open Excel with Windows Task Scheduler


Method 1 to Auto Run Access From – Select Display Form


In Access 2013, navigate to Options > Current Database > Display Form, where you can choose from a list of Forms in the database. The form will auto open once Access is opened.


autorun_Form_01


Method 2 to Auto Run Access From – Create Macro


Create a Macro: Create > Macro > Open Form > select Form1 in Form Name


autorun_Form_02


Save Macro as “autoexec”


autorun_Form_03


Now you see the below autoexec Macro in the Navigation Pane, Form1 will pop up when Access is reopened.


autorun_Form_04


Method 3 to Auto Run Access From – Write VBA code


This method uses DoCmd.openForm to open Form. If you try to run other Procedure other than auto opening a Form, you should use this Method.


Press ALT+F11 > Insert Module > copy and paste the below Function


Public Function openForm()

   DoCmd.openForm “Form1″, acNormal, , , acFormEdit, acWindowNormal

End Function

Create a Macro to use this Function: Create > Macro > RunCode > type openForm() in Function Name


autorun_Form_02


Finally, save Macro as “autoexec”


autorun_Form_04


Outbound References


https://www.youtube.com/watch?v=1Jk-e010y2M


 



Auto Run Access Form using AutoExec

沒有留言:

張貼留言