Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data missing when printing a dirty record / form!!

Status
Not open for further replies.

Oliver2003

Technical User
Apr 19, 2003
144
GB
I have a form where data is entered and updated - on this form I have a cmb which prints a report for the current record using the docmd.openreport method.

The problem I am having is that when new data has been added to the form and the print button is clicked, the report will print off but not with any of the new data.

I am having to go to the pervious record and then back to the current record so that the data is saved and the report prints ok.

Is there a way to prevent this?

cheers.
 
Yes,

The reason is that the changes you've made are just to the form - You have not stored those changes back into the underlying table. When you run the report it looks at the table - not at the form ( The report is, after all bound to the table )

So what you need to do is add a line in the cmd button On_Click event , before the DoCmd.OpenReport that saves the changes on the form to the table.

Code:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Will do fine.



'ope-that-'elps.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Thank you very much LittleSmudge thats just what I wanted
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top