Hi all
I have a form with required fields. I also have a quit button that exits out of Access completly.
Problem is if one of these required fields isnt filled out and the user wants to quit not caring if they loose the information, access gives them an error message they dont understand. I want to replace this error message with my own yes/no msgbox telling them they will loose data and asking if they would like to proceed.
this is the code i use:
#####################################################
Private Sub cmdclose_Click()
On Error GoTo errortrap1
'** if i use docmd.quit it will bypass the error supression. Using Docmd.GoToRecord forces it to the msgbox suppression section. **
DoCmd.GoToRecord , , acFirst
errortrap1:
If MsgBox("Some or all required fields are incomplete. Quiting will result in deleting the current record. Do you wish to proceed?", vbYesNo, "Oh Dear!!"
= 6 Then
Resume errorexit1
Else
Exit Sub
End If
errorexit1:
DoCmd.Quit
exit sub
#####################################################
No matter what i do i still get the default error message. Is there a way around it?
thanks in advance
wah
ps i use the same method when navigating between records and it works fine.
I have a form with required fields. I also have a quit button that exits out of Access completly.
Problem is if one of these required fields isnt filled out and the user wants to quit not caring if they loose the information, access gives them an error message they dont understand. I want to replace this error message with my own yes/no msgbox telling them they will loose data and asking if they would like to proceed.
this is the code i use:
#####################################################
Private Sub cmdclose_Click()
On Error GoTo errortrap1
'** if i use docmd.quit it will bypass the error supression. Using Docmd.GoToRecord forces it to the msgbox suppression section. **
DoCmd.GoToRecord , , acFirst
errortrap1:
If MsgBox("Some or all required fields are incomplete. Quiting will result in deleting the current record. Do you wish to proceed?", vbYesNo, "Oh Dear!!"
Resume errorexit1
Else
Exit Sub
End If
errorexit1:
DoCmd.Quit
exit sub
#####################################################
No matter what i do i still get the default error message. Is there a way around it?
thanks in advance
wah
ps i use the same method when navigating between records and it works fine.