Every version of Microsoft Access includes the example database Northwind. When you open the Northwind database a particular form open. This tradition continues with Access 2010. If you create Northwind in Access 2010 using the supplied template, and then open the database, a form opens, depending on whether the file sources is trusted or not. Then a Login form loads where you make a selection and then the Home form opens. This article describes how this is done.

When you learn all about Microsoft Access including form creation, you also learn how to set a particular form to open when the database is opened. Interestingly, Northwind 2010 does not use this method. Instead the starting forms are triggered by a macro. If you have Northwind 2010 open you can see how this done.

So with Northwind 2010 open, navigate to the Macros group. If you're not sure how to do this, click once on Northwind Traders category at the top of the Navigation pane and choose Object Type. You should then see the traditional groups of Tables, Queries, Forms, Reports, Macros and Modules displayed. If you expand the Macros group you'll see the Autoexec macro. The Autoexec macro launches when the Northwind 2010 database is opened.

If you right click on the Autoexec macro, and choose Design View you'll see the macro actions in the right hand side of the display. In the upper part you can see the actions which detects whether the file is from a trusted location or not. If the source is not trusted, the Start Screen form opens. This is the screen which tells you to click the Enable button if you want to proceed.

If the database file is from a trusted source, then the form Login Dialog is opened. This is the login form where you see the staff list on the pop down selector. You then choose a member of staff and click Login to proceed. Note that cboCurrentEmployee is used to store the selected staff name. To see what happens next we need to examine the event associated with this button. So you can close the Autoexec macro, choose the Forms group and open the Login Dialog form in design view.

To see the events triggered when the Login button is clicked, select the properties for the button, and in the property sheet choose the Events tab. Look down the list of events and you'll see the On Click property with [Embedded Macro] next to it. Click the button with the three dots at the far right of the On Click property and you'll see the embedded macro which runs when the button is clicked. Note that cboCurrentEmployee appears again, as the selected name from the login pop down is carried forward, and the Home form is opened. So to follow the trail, close the Macro and then the Login form, and open the Home form in design view.

At the top of the Home form you'll see another combo. When this form opens in regular view, this combo has its default value set to the name selected in the Login form. You can see this if you select the combo's property sheet and look at the Default Value expression. The Home form also contains three subforms with properties linked to this same selected staff name. So the Home form data is derived using the name selected in the Login form.

If you're interested in learning more about use of macros, button events and form properties in Access 2010 you might consider attending a training course. This way you can gain lots of new skills in a relatively short time and really boost your Access capabilities.