Report from a Parameterized Query

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

Guest

I have a report generated from a parameterized query. I want to print the from a form and pass the parameter to the report from information on the form rather than prompting the user

I hope I have been clear enough to enable assistance. Thanks in advance.
 
Drop the parameter from the query, and use the WhereCondition of the
OpenReport action instead.

For example, to print the record that has the same InvoiceID number as the
record in the form, put this into the event procedure of your command
button:

Private Sub cmdPrintRecord_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Make sure there is a record to print.
MsgBox "Select the record to print."
Else
strWhere = "InvoiceID = " & Me.[InvoiceID]
DoCmd.OpenReport "MyReport", acViewPreview, , strWhere
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bob Mullen said:
I have a report generated from a parameterized query. I want to print the
from a form and pass the parameter to the report from information on the
form rather than prompting the user.
 
Back
Top