Print Report for current Invoice Number

  • Thread starter Thread starter Maureen227
  • Start date Start date
M

Maureen227

I have a form with invoice data and would like to print a report with a
button on the form. My problem is I don't know how to tell the report
to print for the current record's invoice number.

Any help would be great. Thanks ahead
Maureen
 
I have a form with invoice data and would like to print a report with a
button on the form. My problem is I don't know how to tell the report
to print for the current record's invoice number.

Any help would be great. Thanks ahead
Maureen

Assuming the Invoice number is a unique prime key field and is a
Number datatype, not text:

DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = " &
Me![InvoiceNumber]

If [InvoiceNumber] is text, then use:

DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = '"
& Me![InvoiceNumber] & "'"
 
fredg said:
I have a form with invoice data and would like to print a report with a
button on the form. My problem is I don't know how to tell the report
to print for the current record's invoice number.

Any help would be great. Thanks ahead
Maureen

Assuming the Invoice number is a unique prime key field and is a
Number datatype, not text:

DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = " &
Me![InvoiceNumber]

If [InvoiceNumber] is text, then use:

DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = '"
& Me![InvoiceNumber] & "'"

Fred
This work great. Thanks a Terabyte.
My in voice number was a text box and i was using the code for a number
field.
Maureen
 
this works great, however - how can we capture any new data on this form -
not showing up when the button is pushed.
Thanks,


fredg said:
I have a form with invoice data and would like to print a report with a
button on the form. My problem is I don't know how to tell the report
to print for the current record's invoice number.

Any help would be great. Thanks ahead
Maureen

Assuming the Invoice number is a unique prime key field and is a
Number datatype, not text:

DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = " &
Me![InvoiceNumber]

If [InvoiceNumber] is text, then use:

DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = '"
& Me![InvoiceNumber] & "'"
 
this works great, however - how can we capture any new data on this form -
not showing up when the button is pushed.
Thanks,

fredg said:
I have a form with invoice data and would like to print a report with a
button on the form. My problem is I don't know how to tell the report
to print for the current record's invoice number.

Any help would be great. Thanks ahead
Maureen

Assuming the Invoice number is a unique prime key field and is a
Number datatype, not text:

DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = " &
Me![InvoiceNumber]

If [InvoiceNumber] is text, then use:

DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = '"
& Me![InvoiceNumber] & "'"

Newly entered data in a form is not saved until you close the form,
move to another record, or explicitly tell it to save the record.

Add one line of code to the command button click event to first save
the record:

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "Reportname", etc......
 
Back
Top