MS Access 2007 Step By Step - Asim Abbasi
CH1: Overview | CH2: MS Access Local & Linked Tables | CH3: MS Access Queries | CH4: MS Access Reports & Forms | CH5: MS Access Modules & Macros | CH6: MS Access Data Import/Export Feature | CH7: MS Access Built-In Functions
Chapter 5: MS Access Modules & Macros
Save & Test Macro

Figure 5-11: Macro Design View.
________________________________________
1. Finally click the save button as shown in Figure 5-11 with label 1
and name your macro as AutoExec. Any macro having the name AutoExec in
MS Access will get executed automatically as soon as MS Access gets
alive or in other words when you double click MS Access icon on your
desktop.
2. Close out the MS Access macro design window as shown in Figure 5-11
with label 2.
If you want to Run or go back to the Design View of already created
macro then right-click the macro name as shown in the Figure 5-12 with
label 1. As a result of this action a window will pop-up with Run (Label
2) and Design View (label 3) command on it as shown.
To test the benefit of this macro, close the MS Access environment then
turn it back on. You will see that MS Access will no more ask you for
the login/password stuff. Why? Because as soon as MS Access gets alive
it looks for the macro with the name AutoExec, if it finds then it
executes that macro. In our AutoExec macro we have coded to run AutoExec()
function. This function is the one we created in the earlier part of
this chapter and it in fact contains the login/password information as
well as script to logon to Oracle Server.

Figure 5-12: Opening existing macro in Design View.
________________________________________
Whenever you execute the AutoExec macro nothing will happen apparently
but each time MS Access will supply the credentials (login/password) to
Oracle Database Server. You can notice that by looking at the Network
Activity icon next to the time in your Window XP system.
The icon will blink as soon as you perform this run operation on
AutoExec macro.


Figure 5-13: Monitoring data flow.
________________________________________
If you have not supplied proper Oracle Database user’s credential (login/password) while preparing the code for AutoExec() function you will encounter an error.
Chapter 5: MS Access Modules & Macros
CH1: Overview | CH2: MS Access Local & Linked Tables | CH3: MS Access Queries | CH4: MS Access Reports & Forms | CH5: MS Access Modules & Macros | CH6: MS Access Data Import/Export Feature | CH7: MS Access Built-In Functions
Share with others: