Preview Only One Report

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.
 
J

Jim/Chris

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
 
C

Cameo

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
 

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

Top