Review the VBA Code

3. Try it: Review the Code

The Code begins with: Private Sub

It must finish with: End Sub

"Sub" means subroutine.

 

The first Action is: DoCmd.Open Form

Where "Switchboard" is the Form name.

 

The second Action is: DoCmd.Close

Where "Customers" is the Form name.

 

Error Trapping

The rest of the code looks for errors. If you spell the name of the form wrong, the subroutine should catch that mistake and bring up a message box (MsgBox).

 

Error trapping is a good thing. It keeps the computer from running around in circles if it can't figure something out.

 

Please Save and Close the VBA editor.

 

When you return to your Access database, Save and Close the Customer Form.

Microsoft Visual Basic for Applications

Exam 77-885: Microsoft Access 2010

3. Building Forms

3.2. Apply Form Design options: View Visual Basic Code