Preview Only One Report

  • Thread starter Thread starter Troy
  • Start date Start date
T

Troy

I have a form with a preview report button on it, and
when clicked it previews all the records. I would like to
only preview and print the report for the record I am
currently viewing only. How can this be done?

Thanks.
 
I assume you are viewing the record in a form. Base the
report on a query with the criteria being equal to the
record Id control name on the form

ex: [Forms]![form name]![control]

Jim
 
Try this...I use it all the time!
********************************************
Private Sub Button_Click()
On Error GoTo Err_Button_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "ReportName"

stLinkCriteria = "[FormID]=" & Me![FormID]
DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria

Exit_Button_Click:
Exit Sub

Err_Button_Click:
MsgBox Err.Description
Resume Exit_Button_Click

End Sub
 
Back
Top