Report from Form w/Criteria

S

Scott B

Greetings,

I have a form that derives it's data from a query with criteria [Type
Arrival Date]. I have a report that is opened with a command button from
the form with the following code on the On Click event:

Private Sub cmdPrintArrivals_Click()
On Error GoTo Err_cmdPrintArrivals_Click

Dim stDocName As String

stDoc = "rptGuestArrivals"
stCriteria = "ID = " & Me.ID
DoCmd.OpenReport stDoc, acNormal, , stCriteria

Exit_cmdPrintArrivals_Click:
Exit Sub

Err_cmdPrintArrivals_Click:
MsgBox Err.Description
Resume Exit_cmdPrintArrivals_Click

End Sub

Can anyone tell me how I make it so the report takes the criteria from the
form without the criteria pop-up appearing when the report is opened from
the command button? The form and the report both use the same query.

Thanks,
Scott B
 

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