Record Will Not Add

J

jutlaux

I have a form that is used to print a very basic report. The form has two
fields

Field1 = InvoiceNumber, which in the underlying table is set to AutoNumber
Feild2 = Company, which is a combo box with all the company's that can be
selected.

They way it is suppose to work is when the form opens the user selects the
company, which then creates the Invoice Number. Then the user hits a print
button that opens a standard report with the invoice number and company on it.

The problem I have is when the user selects the company then Invoice Number
is in fact generated, but when they go to view the report the invoice number
and company don't show up. Upon further investigation I found that the
Invoice number and company are not being added to the table until the form is
closed. The only reason I can't close the form is the Report that is run is
linked to a query that looks back to the form for the Invoice Number.

How can I get the record to immediately add to the table without closing the
form?

Thanks,
 
D

Dirk Goldgar

jutlaux said:
I have a form that is used to print a very basic report. The form has two
fields

Field1 = InvoiceNumber, which in the underlying table is set to AutoNumber
Feild2 = Company, which is a combo box with all the company's that can be
selected.

They way it is suppose to work is when the form opens the user selects the
company, which then creates the Invoice Number. Then the user hits a
print
button that opens a standard report with the invoice number and company on
it.

The problem I have is when the user selects the company then Invoice
Number
is in fact generated, but when they go to view the report the invoice
number
and company don't show up. Upon further investigation I found that the
Invoice number and company are not being added to the table until the form
is
closed. The only reason I can't close the form is the Report that is run
is
linked to a query that looks back to the form for the Invoice Number.

How can I get the record to immediately add to the table without closing
the
form?


I'm assuming that you Print button is on the form. Use that button to save
the record before opening the report. For example:

Private Sub cmdPrint_Click()

' Save current record, if it has been modified.
If Me.Dirty Then Me.Dirty = False

' Open the report.
DoCmd.OpenReport "rptInvoices", acViewPreview

End Sub
 

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