P
Pele
Question 1
I have used the command button wizard to create a button on a form. The
intention is to use that button to print a specific form regardless of which
form the button is attached to. Unfortunately, when the button is clicked, it
always prints off the form on which the button was attached to as opposed to
the form indicated in the code below.
So, what code should I use that will allow a command button to print a
specific form regardless of where the command button was pressed.
Thanks for your help.
Pele
Private Sub Form_Printer_Click()
On Error GoTo Err_Form_Printer_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "Frm_View Schedule Tbl"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
Exit_Form_Printer_Click:
Exit Sub
Err_Form_Printer_Click:
MsgBox Err.Description
Resume Exit_Form_Printer_Click
End Sub
I have used the command button wizard to create a button on a form. The
intention is to use that button to print a specific form regardless of which
form the button is attached to. Unfortunately, when the button is clicked, it
always prints off the form on which the button was attached to as opposed to
the form indicated in the code below.
So, what code should I use that will allow a command button to print a
specific form regardless of where the command button was pressed.
Thanks for your help.
Pele
Private Sub Form_Printer_Click()
On Error GoTo Err_Form_Printer_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "Frm_View Schedule Tbl"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
Exit_Form_Printer_Click:
Exit Sub
Err_Form_Printer_Click:
MsgBox Err.Description
Resume Exit_Form_Printer_Click
End Sub