Re: Saving changes on form before running a report

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Mon, 17 Oct 2005 15:29:01 -0700, iholder wrote:

> 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.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
.



Relevant Pages

  • Re: Parameter value in Query
    ... > When I went to run the report, ... > Access cannot find the macro Do.Cmd. ... >>Click the command button and then report will run. ... When the event code window opens, the cursor will be flashing between ...
    (microsoft.public.access.queries)
  • Re: Print dialog using OpenReport.... acNormal?
    ... Using the following command, is there any way to get the printer dialog to ... I most packages, when you click print, it will open the printer ... Replacing acViewNormal with acViewPreview will open the report in preview ...
    (comp.databases.ms-access)
  • Re: Report Error With No Data
    ... The report exports to Excel fine, but when there is no data abends from the ... Is there a way after issuing this command: ... DoCmd.OpenReport Me.cboReportType, acViewPreview, to NOT issue the next ...
    (microsoft.public.access.reports)
  • Re: Select Thing in Report
    ... Let's assume you wish to filter the report so that only records ... Add a Command Button to the form. ... When the code window opens, the cursor will be flashing between 2 ...
    (microsoft.public.access.reports)
  • Re: Command button report selection
    ... My report names are not for ... > change the last argument form acViewPreview to acViewNormal. ... >> I'm trying to create a Form that based on the users combo box selections, ... >> the correct report will run when a command button is selected. ...
    (microsoft.public.access.reports)