Professional Documents
Culture Documents
' Use specified method while trapping for BOF and EOF
Select Case intCommand
Case 1
rstAuthors.MoveFirst
Case 2
rstAuthors.MoveLast
Case 3
rstAuthors.MoveNext
If rstAuthors.EOF Then
MsgBox "Already at end of recordset!"
rstAuthors.MoveLast
End If
Case 4
rstAuthors.MovePrevious
If rstAuthors.BOF Then
MsgBox "Already at beginning of recordset!"
rstAuthors.MoveFirst
End If
End Select
Loop
' clean up
rstAuthors.Close
Cnxn.Close
Set rstAuthors = Nothing
Set Cnxn = Nothing
Exit Sub
ErrorHandler:
' clean up
If Not rstAuthors Is Nothing Then
If rstAuthors.State = adStateOpen Then rstAuthors.Close
End If
Set rstAuthors = Nothing
If Not Cnxn Is Nothing Then
If Cnxn.State = adStateOpen Then Cnxn.Close
End If
Set Cnxn = Nothing
If Err <> 0 Then
MsgBox Err.Source & "-->" & Err.Description, , "Error"
End If
End Sub
'EndMoveFirstVB