Help with "Where" on command button

T

Tony Williams

I have a command button on a form that opens a report. Here is my code
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click

Dim stDocName As String

stDocName = "InvoiceReprint"
DoCmd.OpenReport stDocName, acPreview

Exit_Command3_Click:
Exit Sub

Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click

End Sub
How do I add a "Where" statement that will open a report only where the
control "invnbr" on my report equates to a control "repinvnbr" on the form
"reprintinvoices" which has the command button.

many thanks
Tony
 
T

Tony Williams

As ever thanks Marsh
Tony
Marshall Barton said:
Dim stWhere As String
...
stWhere = "invnbr=" & Me.repinvnbr
DoCmd.OpenReport stDocName, acPreview, , stWhere
...
 

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