Print report from Form

  • Thread starter Thread starter Kelly
  • Start date Start date
K

Kelly

I have a form in which the user edits data. They want to
be able to print a report immediately after updating data
in the form. When the user clicks the print button on the
form, only the old data is printed, not the updates just
made. How do I write the changes to the db record before
the report is executed?

Thx,
Kelly
 
What the user see on screen is the data in the Form's Current Record buffer
(which has not been updated into the Table) while the Report gets the data
from the Table.

You need to save / update the Record into the Table before running the
Report. You can use the statement:

DoCmd.RunCommand acCmdSaveRecord

in the existing CommandButton_Click Event to save the Record before opening
the Report.
 
I have a form in which the user edits data. They want to
be able to print a report immediately after updating data
in the form. When the user clicks the print button on the
form, only the old data is printed, not the updates just
made. How do I write the changes to the db record before
the report is executed?

Thx,
Kelly

You need to save the new data first.
Access doesn't save new data until you go to another (or new) record,
close the form, or explicitly tell it to.
Add one line of code the click event of the command button used to
print the report:

DoCmd.RunCommand acCmdSaveRecord

Then continue with whatever other code you have
 
I have a form in which the user edits data. They want to
be able to print a report immediately after updating data
in the form. When the user clicks the print button on the
form, only the old data is printed, not the updates just
made. How do I write the changes to the db record before
the report is executed?

If Me.Dirty Then Me.Dirty = False

Put that at the top of the code to open/print the report.

- Jim
 
Kelly said:
I have a form in which the user edits data. They want to
be able to print a report immediately after updating data
in the form. When the user clicks the print button on the
form, only the old data is printed, not the updates just
made. How do I write the changes to the db record before
the report is executed?

You have to save the record before opening the report.
Here's a way to do it:

If Me.Dirty Then Me.Dirty = False
 
Thanks! I knew there had to be a save record command, I
just couldn't find it! That works, too! I'm back in
business, for now.
 
Back
Top