Create a command button on a form use the wizard. Specify that the command button will open a report.
it will generate a code that looks like this:
Private Sub Command1_Click()
On Error GoTo Err_Command1_Click
Dim stDocName As String
stDocName = "MyReport"
DoCmd.OpenReport stDocName, acNormal
Exit_Command1_Click:
Exit Sub
Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click
End Sub
--Then modify it to look like this:
How can I print only one record using a report?
Use the OpenReport's Where condition to specify your record. For example, the following code placed behind a command button on the form would use the CurrentRecordNow control on the form to restrict the Report to only one record.
Dim stDocName As String
Dim stWhere As String
strDocName = "rptSomeReport"
strWhere = "[CurrentRecordNow]=" & me!CurrentRecordNow
DoCmd.OpenReport strDocName, acPreview, , strWhere
so your code will look like
Dim stDocName As String
dim stWhere As String
stDocName = "MyReport"
strWhere = "[CurrentRecordNow]=" & me!CurrentRecordNow
DoCmd.OpenReport strDocName, acPreview, , strWhere
[CurrentRecordNow] the name of the textbox of the current record.