I am probably just doubting myself, but this code does what i want it to, but just doesn't seem 'elegant'.
I want to print the results of "Query1" using a button on a form.
Code: Select all
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim stDocName As String
stDocName = "Query1"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.PrintOut
DoCmd.Close
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
Michael