& vbCrLf & vbTab & “City: “ & ![City] _
& vbCrLf
rst.MoveNext
Loop
End WithErrorHandlerExit:Close the Recordset and Connection objects.
If Not rst Is Nothing Then
If rst.State = adStateOpen Then
rst.Close
Set rst = Nothing
End If
End IfIf Not cnn Is Nothing Then
If cnn.State = adStateOpen Then
cnn.Close
Set cnn = Nothing
End If
End IfExit SubErrorHandler:
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit
End SubThe following information is printed to the Immediate window:
2 records in recordsetAustralian Company name: G’day, Mate
Contact name: Wendy Mackenzie
City: SydneyAustralian Company name: Pavlova, Ltd.
Contact name: Ian Devling
City: MelbourneForward-only
The forward-only cursor (DAO equivalent: dbOpenForwardOnly) allows only forward move-
ment through a recordset and doesn’t show additions, changes, or deletions made by other users.
Working with Access Data 5