smercer
Registered User.
- Local time
- Today, 17:22
- Joined
- Jun 14, 2004
- Messages
- 442
Hi all
I am trying to open the same popup dialog box form from different forms for the same purpose(Print confirmation), and I don't want to copy the same form and use different copies for different forms.
The way I would like to get around this is to use a global variable and set the variable according to the form that opened the popup and when user clicks cancel the dialog form will close and the corresponding form in Print preview to close and the original form that opened these to reopen in normal mode
The variable in question is Previous_Form
Here is my code for a button in the control panel form:
Here is the code in dialog box:
Does any one have any ideas?
Thanks in advance
I am trying to open the same popup dialog box form from different forms for the same purpose(Print confirmation), and I don't want to copy the same form and use different copies for different forms.
The way I would like to get around this is to use a global variable and set the variable according to the form that opened the popup and when user clicks cancel the dialog form will close and the corresponding form in Print preview to close and the original form that opened these to reopen in normal mode
The variable in question is Previous_Form
Here is my code for a button in the control panel form:
Code:
Private Sub cmd_Print_Book_list_Click()
'Summery:
'This will print the form "frm_Nest_frm_Books_Descriptions_in_Store_DatasheetView_Popup"
'*********************************************************************************************************
DoCmd.OpenForm "frm_Nest_frm_Books_Descriptions_in_Store_DatasheetView_Popup", acNormal, , , acHidden 'this will open the form "frm_Nest_frm_Books_Descriptions_in_Store_DatasheetView_Popup" in print preview
Form_frm_Nest_frm_Books_Descriptions_in_Store_DatasheetView_Popup.OnClose = ""
Form_sfrm_Books_Descriptions_in_Store_Datasheet_Popup.OnLoad = ""
DoCmd.OpenForm "frm_Nest_frm_Books_Descriptions_in_Store_DatasheetView_Popup", acPreview, , , acFormReadOnly
DoCmd.Maximize ' this will maximize "frm_Nest_frm_Books_Descriptions_in_Store_DatasheetView_Popup"
DoCmd.OpenForm "dlg_print_conferm", acNormal, , , acFormReadOnly 'this will open the print conferm dialog box
Previous_Form = """frm_Control_Panel"""
DoCmd.Close acForm, "frm_Control_Panel", acSaveNo 'this will close form "frm_Control_Panel"
End Sub
Here is the code in dialog box:
Code:
Sub cmdCancel_Click()
DoCmd.Close acForm, "dlg_print_conferm", acSaveNo
DoCmd.Close acForm, "Form_frm_Nest_frm_Books_Descriptions_in_Store_DatasheetView_Popup", acSaveNo
DoCmd.OpenForm Previous_Form, acNormal, , , acFormEdit, acNormal
DoCmd.Maximize
End Sub
[B]'__________________________________________[/B]
Private Sub cmdOK_Click()
On Error GoTo NoPrinter
DoCmd.Close acForm, "dlg_print_conferm", acSaveNo
With Form_frm_Nest_frm_Books_Descriptions_in_Store_DatasheetView_Popup
DoCmd.PrintOut acPrintAll, , , acDraft, 1, True
End With
DoCmd.Close acForm, "Form_frm_Nest_frm_Books_Descriptions_in_Store_DatasheetView_Popup", acSaveNo
DoCmd.OpenForm Previous_Form, acNormal, , , acFormReadOnly, acNormal
DoCmd.Maximize
Exit Sub
NoPrinter:
MsgBox "You do not have your printer ready"
DoCmd.Close acForm, "Form_frm_Nest_frm_Books_Descriptions_in_Store_DatasheetView_Popup", acSaveNo
DoCmd.OpenForm Previous_Form, acNormal, , , acFormReadOnly, acNormal
DoCmd.Maximize
End Sub
Does any one have any ideas?
Thanks in advance