R
Robert Robinson
I have created a form which generates an invoice number. I have also created
an invoice (report) which is based on the values in this form. The report is
based on a query which prompts for invoice number. Thus when the user prints
the invoice based on the data in the current screen, they are prompted to
enter the invoice number (a duplication of effort). What I would like to do
is code the form to pass the current invoice number to the query which powers
the report (invoice). I have tried to code this in the On Click command button
Private Sub Preview_Invoice_Click()
On Error GoTo Err_Preview_Invoice_Click
If Not IsNull(Me![InvoiceID]) Then
Invoice![InvoiceID] = Me![InvoiceID]
DoCmd.OpenReport "Invoice", acPreview
Exit_Preview_Invoice_Click:
Exit Sub
Err_Preview_Invoice_Click:
MsgBox Err.Description
Resume Exit_Preview_Invoice_Click
End Sub
However, I can not get the invoice date to pass into the invoice report. Am
I off with the command passing the invoice number to the invoice report
(should that code come after the DoCmd code?) Is it because I am passing the
invoice number to the report, rather than the query? Please advise.
an invoice (report) which is based on the values in this form. The report is
based on a query which prompts for invoice number. Thus when the user prints
the invoice based on the data in the current screen, they are prompted to
enter the invoice number (a duplication of effort). What I would like to do
is code the form to pass the current invoice number to the query which powers
the report (invoice). I have tried to code this in the On Click command button
Private Sub Preview_Invoice_Click()
On Error GoTo Err_Preview_Invoice_Click
If Not IsNull(Me![InvoiceID]) Then
Invoice![InvoiceID] = Me![InvoiceID]
DoCmd.OpenReport "Invoice", acPreview
Exit_Preview_Invoice_Click:
Exit Sub
Err_Preview_Invoice_Click:
MsgBox Err.Description
Resume Exit_Preview_Invoice_Click
End Sub
However, I can not get the invoice date to pass into the invoice report. Am
I off with the command passing the invoice number to the invoice report
(should that code come after the DoCmd code?) Is it because I am passing the
invoice number to the report, rather than the query? Please advise.