Users can delete records by navigating to a particular record and clicking on
the delete button. Our application prompts the user to verify the deletion,
then deletes the record using DbDelete. The program then refreshes the screen with the next record or with the
previous record if the user deleted the last record in the dynaset.
The delete click event procedure looks like:
Private Sub cmdDelete_Click()
'prompt user
Response = MsgBox("Do you really want to Delete?", vbYesNo + vbExclamation)
If Response = vbYes Then
EmpDynaset.Delete
'attempt to move to next record
EmpDynaset.MoveNext
If EmpDynaset.EOF Then 'If deleted last record
EmpDynaset.MovePrevious
End If
Call EmpRefresh
End If
End Sub