Printing current record in a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to print off records in a report. I only want 1 recored to be
printed off at a time........not all records in the table. I have a form
that calls on a query to bring up the record I want to print. Is there any
way to accomplish this? Thanks.

Omar
 
This is answered often. Please search previous posts (google groups is good
for this) before posting a new message.

Hope the following helps, Rick B



Button to print specific record:

Private Sub cmdPrint_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 = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.
 
Back
Top