Creating a report for 1 record from a query

R

Rpainter

I have a report that prints all records from a particular query, but I'm
wanting to print just 1 record. Sorta like selecting a company that has
multiple invoices, but only wanting to print 1. Can somebody help me?

Thanks.
 
D

Damian S

Hi Rpainter,

You could either have your query so that it uses the ID in the criteria
field, or open your report like this:

docmd.OpenReport "REPORTNAME", acViewPreview,,"ID = 3"

Hope this helps.

Damian.
 
D

Douglas J. Steele

It's a WHERE clause (without the word WHERE) that limits the report to only
those records that match the condition.

It could be a variable:

Dim strFilter As String

strFilter = "ID = 3"
DoCmd.OpenReport "REPORTNAME", acViewPreview,,strFilter
 
Top