Guest_imported
New member
- Jan 1, 1970
- 0
Hi
Thanks larry for yur help. I tried it and there is an error. It says object or method not found at DoCmd.Undo
Here is the latest code:
Private Sub Add_Click()
On Error GoTo Err_Add_Click
Dim i
DoCmd.GoToRecord , , acNewRec
Exit_Add_Click:
Exit Sub
Err_Add_Click:
If Err.Number = 3022 Then
If MsgBox("The Student ID has to be unique. Click on OK to change or Click on Cancel to erase.", vbOKOnly, "Student Database "
= vbCancel Then
DoCmd.Undo
Else
Exit Sub
End If
Else
MsgBox Err.Description
Resume Exit_Add_Click
End If
End Sub
Thanks larry for yur help. I tried it and there is an error. It says object or method not found at DoCmd.Undo
Here is the latest code:
Private Sub Add_Click()
On Error GoTo Err_Add_Click
Dim i
DoCmd.GoToRecord , , acNewRec
Exit_Add_Click:
Exit Sub
Err_Add_Click:
If Err.Number = 3022 Then
If MsgBox("The Student ID has to be unique. Click on OK to change or Click on Cancel to erase.", vbOKOnly, "Student Database "
DoCmd.Undo
Else
Exit Sub
End If
Else
MsgBox Err.Description
Resume Exit_Add_Click
End If
End Sub