Print 2 reports

R

Richard

Hi,

Is it possible to print 2 copies of my report using the following code?
thanks.
*************************************************

Private Sub Command27_Click()
On Error GoTo Err_Command27_Click
Dim strWhere As String

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
strWhere = "[WarehouseID] = " & Me.[WarehouseID]
DoCmd.OpenReport "rptWarehouse", acViewNormal, , strWhere
DoCmd.GoToRecord , , acNewRec
Driver.SetFocus
End If

Exit_Command27_Click:
Exit Sub

Err_Command27_Click:
MsgBox Err.Description
Resume Exit_Command27_Click

End Sub
 
T

Tom van Stiphout

On Thu, 3 Jan 2008 15:07:01 -0800, Richard

No. This code prints the report once. You could show the report in
preview mode, and have the user decide whether or not to print it, and
if so, how many times.
If you just want two prints, double up on the DoCmd.OpenReport line.
 
N

NetworkTrade

I believe just duplicating the open report command will print twice...

DoCmd.OpenReport "rptWarehouse", acViewNormal, , strWhere
DoCmd.OpenReport "rptWarehouse", acViewNormal, , strWhere

try copy/paste that line inserted in line just below where it appears
originally in the code and see what happens....
 
R

Richard

Thanks to both of you it does print 2 reports with a silght delay but it does
work.

NetworkTrade said:
I believe just duplicating the open report command will print twice...

DoCmd.OpenReport "rptWarehouse", acViewNormal, , strWhere
DoCmd.OpenReport "rptWarehouse", acViewNormal, , strWhere

try copy/paste that line inserted in line just below where it appears
originally in the code and see what happens....

--
NTC


Richard said:
Hi,

Is it possible to print 2 copies of my report using the following code?
thanks.
*************************************************

Private Sub Command27_Click()
On Error GoTo Err_Command27_Click
Dim strWhere As String

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
strWhere = "[WarehouseID] = " & Me.[WarehouseID]
DoCmd.OpenReport "rptWarehouse", acViewNormal, , strWhere
DoCmd.GoToRecord , , acNewRec
Driver.SetFocus
End If

Exit_Command27_Click:
Exit Sub

Err_Command27_Click:
MsgBox Err.Description
Resume Exit_Command27_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top