Please note: I am NOT familiar with VBA so any replies please talk as much as possible in layman terminology. Thank you!
I have created a simple form to add data to a table. I have added two buttons, a "next" button and a "exit" button. When a user tries to enter a duplicate value in a field that does not allow duplicates, the error message is non-specific "?????????????????????????"
I have succeeded in modifying the error message to be more descriptive for the "next" button but not the "exit" button. I attempted the same code for both so I am not sure why? I am including my code below. I am using Access 97. Thank you so much.
Option Compare Database
Option Explicit
Private Sub btnNext_Click()
On Error GoTo Err_btnNext_Click
DoCmd.GoToRecord , , acNext
Exit_btnNext_Click:
Exit Sub
Err_btnNext_Click:
MsgBox ("ID already ordered")
Resume Exit_btnNext_Click
End Sub
Private Sub btnExit_Click()
On Error GoTo Err_btnExit_Click
DoCmd.Quit
Exit_btnExit_Click:
Exit Sub
Err_btnExit_Click:
MsgBox ("ID already ordered")
Resume Err_btnExit_Click
End Sub
I have created a simple form to add data to a table. I have added two buttons, a "next" button and a "exit" button. When a user tries to enter a duplicate value in a field that does not allow duplicates, the error message is non-specific "?????????????????????????"
I have succeeded in modifying the error message to be more descriptive for the "next" button but not the "exit" button. I attempted the same code for both so I am not sure why? I am including my code below. I am using Access 97. Thank you so much.
Option Compare Database
Option Explicit
Private Sub btnNext_Click()
On Error GoTo Err_btnNext_Click
DoCmd.GoToRecord , , acNext
Exit_btnNext_Click:
Exit Sub
Err_btnNext_Click:
MsgBox ("ID already ordered")
Resume Exit_btnNext_Click
End Sub
Private Sub btnExit_Click()
On Error GoTo Err_btnExit_Click
DoCmd.Quit
Exit_btnExit_Click:
Exit Sub
Err_btnExit_Click:
MsgBox ("ID already ordered")
Resume Err_btnExit_Click
End Sub