Here is my code:
Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = Me.Name
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
Exit_cmdPrint_Click:
Exit Sub
Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub
This is a Print button on a form. This works fine in my Access2000 mdb but as soon as I make a mde it no longer works and gives me the error "The command or action 'Print Out' isn't available now." Does anyone know how I can get this button to work from the mde. I can go to the top and select File/Print and it works, but I also need this button to work.
Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = Me.Name
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
Exit_cmdPrint_Click:
Exit Sub
Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub
This is a Print button on a form. This works fine in my Access2000 mdb but as soon as I make a mde it no longer works and gives me the error "The command or action 'Print Out' isn't available now." Does anyone know how I can get this button to work from the mde. I can go to the top and select File/Print and it works, but I also need this button to work.