Preview Report Based On Form

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

Guest

I have a form for data entry and wish to generate a report for printing the
information. I need the report to only show the relevant records for the
information that is currently being entered instead of all the records.

For example, a user is entering information into a form and there is a
button that opens up this report and I need the report to popup for that
particular customerID and invoiceID which is currently being entered into a
form.

How do I do that? Thanks.
 
Use the command button wizard to create the code to open the report. Then
open the code module and make modifications:

Dim strWhere as String
strWhere = "[InvoiceID]=" & Me.InvoiceID
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere

This assumes your form contains a numeric field [InvoiceID].
 
Back
Top