so i have a button on my switchboard that prints a report... the problem is that when it's clicked, the database window -- which should be hidden! -- is revealed.
the code is (it's just slightly modified wizard code):
the code is (it's just slightly modified wizard code):
Code:
Private Sub cmdPrintAlphaRoster_Click()
On Error GoTo Err_cmdPrintAlphaRoster_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "rptAlphaRoster"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acReport, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
Exit_cmdPrintAlphaRoster_Click:
Exit Sub
Err_cmdPrintAlphaRoster_Click:
MsgBox Err.Description
Resume Exit_cmdPrintAlphaRoster_Click
End Sub