Access.2007.VBA.Bibl..

(John Hannent) #1
Resume Next
Else
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit
End If

End Sub

Private Sub cmdSelectAll_Click()

On Error GoTo ErrorHandler

Set lst = Me![lstSelectContacts]
lngListCount = Me![lstSelectContacts].ListCount

For lngCount = 0 To lngListCount
lst.Selected(lngCount) = True
Next lngCount

ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox “Error No: “ & Err.Number & “; Description: “ _
& Err.Description
Resume ErrorHandlerExit

End Sub

Private Sub cmdDeselectAll_Click()

On Error GoTo ErrorHandler

Set lst = Me![lstSelectContacts]
lngListCount = Me![lstSelectContacts].ListCount

For lngCount = 0 To lngListCount
lst.Selected(lngCount) = False
Next lngCount

ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox “Error No: “ & Err.Number & “; Description: “ _
& Err.Description
Resume ErrorHandlerExit

End Sub

Part I The Office Components and What They Do Best

Free download pdf