VB Code for Events

When you right-click on a form object and select 'Build Event' Access usually gives you a choice of three options:

  • the Expression Builder
  • the Macro Builder
  • the Code Builder

Most developers will always want to use the 'Code Builder' - the VBA editor - so that that can edit Visual Basic code and there is a simple way to bypass the options and get this automatically every time.

  1. Open a database.
  2. Select Options from the Tools menu
  3. Pick the Forms/Reports tab
  4. Click the tick box labelled 'Always use event procedures'
  5. Use the OK button to close the Options dialog.

The next time that you try to create code for an event Access will bypass the choices of Expression Builder and Macro Builder and will take you straight to the VBA code editor.

This works in all versions of Microsoft Access from 97 to 2002. Other startup options are described here.

Access 2007

Access 2007 start button The startup options were moved to a different place with the new interface introduced in Access 2007. If you are using Access 2007 or 2010 you start by clicking the big 'Office' button in the top-left of the screen as the first move. This will bring up a screen of 'Access Options' with a list of components down the left-hand side of the window.

Follow these steps when you have opened the 'Options' window: Access 2007 options

  1. Select Object Designers from the list.
  2. Scroll down to the Forms/Reports section.
  3. Click on the Always use event procedures box.
  4. Click on OK to close the window.

MS Access technical tips

Visual FoxPro technical tips

General Tips

 

More tips from Alvechurch Data

Custom Toolbars

Your Access database will look more impressive if you add custom toolbars.

Read More

Trust Center in Access 2007

Trust Center in Access 2007

Using the Trust Center in Access 2007

Read More

Access 2002 and Office XP

Notes on the launch of Microsoft Access 2002 and Office XP

Read More

Frequent, automatic backups

How to create backups automatically in FoxPro or Access using the Windows Scripting Host

Read More

Visual Basic equivalent of FoxPro file name function

VBA equivalents of FoxPro functions to manipulate names of files and folders

Read More