mattstrachan
Registered User.
- Local time
- Today, 12:57
- Joined
- Feb 22, 2013
- Messages
- 31
Hey all,
I am trying to get a report to print straight out without opening the report in a preview. Here is what I have so far. I know I need to use doCmd.PrintOut but I can not figure out the correct syntax to get it to work. I highlighted the code in question in red.
Private Sub btnPrintLabel_Click()
Dim strPrintLabel As String
If Forms!Product!Qty_Type = "single" Then 'generate 1x1 small label
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strPrintLabel = "[ProductID] = " & Me.[ProductID] 'Print current
DoCmd.OpenReport "Label_Single", acViewPreview, , strPrintLabel
End If
End If
End Sub
What would the syntax look like to print out the first page of the report.
I am trying to get a report to print straight out without opening the report in a preview. Here is what I have so far. I know I need to use doCmd.PrintOut but I can not figure out the correct syntax to get it to work. I highlighted the code in question in red.
Private Sub btnPrintLabel_Click()
Dim strPrintLabel As String
If Forms!Product!Qty_Type = "single" Then 'generate 1x1 small label
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strPrintLabel = "[ProductID] = " & Me.[ProductID] 'Print current
DoCmd.OpenReport "Label_Single", acViewPreview, , strPrintLabel
End If
End If
End Sub
What would the syntax look like to print out the first page of the report.