Print one page of a report

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I have a report that has one page for each record and we
print the report all at once through a print button on a
form. However, I also need to also be able to print the
individual page that responds to the current record. Is
there any way to do this.
 
Use the WhereCondition of the OpenReport action to limit the report to just
the current record.

This example assumes the form is bound to a table that has an AutoNumber
named ID:

Private Sub cmdPrintThisRecord_Click()
If Me.Dirty Then 'Save first.
Me.Dirty = False
End If
If Me.NewRecord Then
Msgbox "Select a record to print."
Else
DoCmd.OpenReport "MyReport", acViewPreview, , "ID = " & Me.[ID]
End If
End Sub
 
If you only want to print for the current record, put a where clause(without
the word where) on your openreport action.

Docmd.openreport "rptName", acviewpreview, ,"CustomerID = " & me.customerID


HTH
Kat
 
Hi Dan,
Make a Command Button that uses Record Operations/Print
Record. If you use Form Operations, it will print all
records - not what you want.

Hope this helps.
 
Back
Top