Saving changes on form before running a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to save changes to the form without using a separate [Save]
command button.

Using a macro. [Tried]
Save
ReQuery - [Control Name]
OpenReport - [Report name]

This does not work.

The changes are not reflected when I run the report.

Help greatly appreciated.
 
I would like to save changes to the form without using a separate [Save]
command button.

Using a macro. [Tried]
Save
ReQuery - [Control Name]
OpenReport - [Report name]

This does not work.

The changes are not reflected when I run the report.

Help greatly appreciated.

It's easy to use some code.
On the Command button (that you already use to open the report)
On Click event line, enter
[Event Procedure]
Then click on the little button with the 3 dots that will appear on
that line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those 2 lines, write:

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

Change "ReportName" to whatever your actual report name is (surrounded
with the quotes as above).

Exit the code window. When you enter data and press the command button
the data is saved and the report will open in Preview. If you wish to
print the report without preview, change acViewPreview to
acViewNormal.
 
Thank You Fred

This works perfect.

Ileana

fredg said:
I would like to save changes to the form without using a separate [Save]
command button.

Using a macro. [Tried]
Save
ReQuery - [Control Name]
OpenReport - [Report name]

This does not work.

The changes are not reflected when I run the report.

Help greatly appreciated.

It's easy to use some code.
On the Command button (that you already use to open the report)
On Click event line, enter
[Event Procedure]
Then click on the little button with the 3 dots that will appear on
that line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those 2 lines, write:

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

Change "ReportName" to whatever your actual report name is (surrounded
with the quotes as above).

Exit the code window. When you enter data and press the command button
the data is saved and the report will open in Preview. If you wish to
print the report without preview, change acViewPreview to
acViewNormal.
 
Hello. I have similar question but vis versa.
I found before the " save" command button was hit, any record changes save
to the table already. Do I have any way to prevent this, let the update
record can only be saved after the "save" command button is pressed???

fredg said:
I would like to save changes to the form without using a separate [Save]
command button.

Using a macro. [Tried]
Save
ReQuery - [Control Name]
OpenReport - [Report name]

This does not work.

The changes are not reflected when I run the report.

Help greatly appreciated.

It's easy to use some code.
On the Command button (that you already use to open the report)
On Click event line, enter
[Event Procedure]
Then click on the little button with the 3 dots that will appear on
that line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those 2 lines, write:

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

Change "ReportName" to whatever your actual report name is (surrounded
with the quotes as above).

Exit the code window. When you enter data and press the command button
the data is saved and the report will open in Preview. If you wish to
print the report without preview, change acViewPreview to
acViewNormal.
 
Back
Top