advanced micorosoft access training - vba access
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access Training and help » advanced micorosoft access training - VBA Access

advanced micorosoft access training - VBA Access

resolvedResolved · Low Priority · Version Standard

replyReply Fri 9 Nov 2007, 16:38Delegate Tim said...

Tim has attended:
Access Intermediate course
Access Advanced course
Access VBA course

VBA Access

How to trap errors

For upcoming training course dates see: Pricing & availability

replyReply Thu 15 Nov 2007, 12:52Trainer David said...

RE: VBA Access

Hi Tim
I trust that you found your Access VBA course useful. To trap errors in VBA, you need to use something known as Error handling. See below for an example:


Function MayCauseAnError()
' Enable error handler.
On Error GoTo MYError_CausesAnError
. ' Include your code here that may cause errors.
.
.

MYError_CausesAnError:
. ' code here to handle error, e.g print message to user
.
.
End Function


So in MYError_CausesAnError, you place you code that could throw up errors. In MYError_CausesAnError you handle your errors, i.e. do nothing, print a message to user, offer other options.

Hope this helps
David

 

Access tip:

Open A Combo Box Automatically

This is helpful if users need to enter large amounts of data. There are two ways to open ComboBoxes when they get the focus by using the tab keys.

When the ComboBox gets focus:

Press Alt + Down Arrow on the keyboard

For it to happen automatically, needs a bit of coding:

1. Add a combo box and a text box control to the form
2. Set the combo box's On Got Focus property to the following event procedure:

Private Sub ComboBoxName _GotFocus()

Me!ComboBoxName.Dropdown

End Sub


3. Open your form in Form View and use the TAB key to make sure it works.

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard