Save Data before Printing

  • Thread starter Thread starter mattc66 via AccessMonster.com
  • Start date Start date
M

mattc66 via AccessMonster.com

Hi All,

On my main form I have a print button that generates a report based on the
data on my form. However if the user makes a change to the data and then hits
print the change is not reflect until he closes the form and then open it
again. So I added the DoCmd.Save to the Print button. This still didn't seem
to fix my problem.

What can I do?
 
mattc66 said:
Hi All,

On my main form I have a print button that generates a report based
on the data on my form. However if the user makes a change to the
data and then hits print the change is not reflect until he closes
the form and then open it again. So I added the DoCmd.Save to the
Print button. This still didn't seem to fix my problem.

What can I do?

Me.Dirty = False

DoCmd.Save is for design changes, not data.
 
Hi Matt...

Insert the following code before opening your report:

if me.dirty then
docmd.runcommand accmdsaverecord
end if

Hope this helps.

Damian.
 
Hi All,

On my main form I have a print button that generates a report based on the
data on my form. However if the user makes a change to the data and then hits
print the change is not reflect until he closes the form and then open it
again. So I added the DoCmd.Save to the Print button. This still didn't seem
to fix my problem.

What can I do?

DoCmd.Save only saves design changes to the form, not the record data.

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "ReportName",acViewPreview
 

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

Back
Top