Hi:
I've created 2 vbYesNo MsgBox
one to save the input and second to print the input.
If I chose not to save the input I want to form "frmOpenAsgmt" to automatically close when I click the No button, how can I get it to work.
Any help is greatly appreciated.
Below is the code where I get stuck:
Private Sub cmdExit_Click()
On Error Resume Next
If MsgBox("Do you wish to save your input? (Selecting No will cancel any additions or changes made.)", vbYesNo) = vbYes Then
vrSavePrompt = True
If MsgBox("Do you wish to print this form?", vbYesNo) = vbYes Then
Dim stDocName As String
Dim MyForm As Form
stDocName = "frmOpenAsgmt"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
End If
DoCmd.Close
End If
Exit_cmdExit_Click:
Exit Sub
I've created 2 vbYesNo MsgBox
one to save the input and second to print the input.
If I chose not to save the input I want to form "frmOpenAsgmt" to automatically close when I click the No button, how can I get it to work.
Any help is greatly appreciated.
Below is the code where I get stuck:
Private Sub cmdExit_Click()
On Error Resume Next
If MsgBox("Do you wish to save your input? (Selecting No will cancel any additions or changes made.)", vbYesNo) = vbYes Then
vrSavePrompt = True
If MsgBox("Do you wish to print this form?", vbYesNo) = vbYes Then
Dim stDocName As String
Dim MyForm As Form
stDocName = "frmOpenAsgmt"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
End If
DoCmd.Close
End If
Exit_cmdExit_Click:
Exit Sub