I have a button on my form "STOP", with the following code behind it :
Private Sub Btn_Finish_Click()
On Error GoTo Err_Btn_Finish_Click
Dim Msg, Style, Title, Response, MyString
Msg = "Do you want to terminate the program ?" '
Style = vbYesNo + vbInformation + vbDefaultButton2 '
Title = "Terminate Program"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
DoCmd.Quit
Else
End If
Exit_Btn_Finish_Click:
Exit Sub
Err_Btn_Finish_Click:
MsgBox Err.Description
Resume Exit_Btn_Finish_Click
End Sub
When the user clicks the STOP-button, it gives the msgbox; when selecting yes, the program stops; when selecting no, the form stays open.
I copied the whole code for the Form_Close-event. When clicking the "close-button [X] = the normal windows-button)
the msgbox comes up with yes and no. However, even when clicking no, the form still closes.
How can I prevent this ?
Regards,
PdtIt
Private Sub Btn_Finish_Click()
On Error GoTo Err_Btn_Finish_Click
Dim Msg, Style, Title, Response, MyString
Msg = "Do you want to terminate the program ?" '
Style = vbYesNo + vbInformation + vbDefaultButton2 '
Title = "Terminate Program"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
DoCmd.Quit
Else
End If
Exit_Btn_Finish_Click:
Exit Sub
Err_Btn_Finish_Click:
MsgBox Err.Description
Resume Exit_Btn_Finish_Click
End Sub
When the user clicks the STOP-button, it gives the msgbox; when selecting yes, the program stops; when selecting no, the form stays open.
I copied the whole code for the Form_Close-event. When clicking the "close-button [X] = the normal windows-button)
the msgbox comes up with yes and no. However, even when clicking no, the form still closes.
How can I prevent this ?
Regards,
PdtIt