Connecting Tech Pros Worldwide Forums | Help | Site Map

Prevent saving a report

Phil Stanton
Guest
 
Posts: n/a
#1: Nov 13 '05
In code I am opening a report in deign view, adding code to the report to
output it to Word in an editable form. I then want t close the report but
not save the changes.
Is there any way or preventing the option to save changes from being
displayed (the answer is always no)

The "DoCmd.Close acReport, me.Name, acSaveNo" on the close event does not
work

TIA

Phil



Bruno Campanini
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Prevent saving a report


"Phil Stanton" <discussion@stantonfamily.co.uk> wrote in message
news:41890243$0$102$65c69314@mercury.nildram.net.. .[color=blue]
> In code I am opening a report in deign view, adding code to the report to
> output it to Word in an editable form. I then want t close the report but
> not save the changes.
> Is there any way or preventing the option to save changes from being
> displayed (the answer is always no)
>
> The "DoCmd.Close acReport, me.Name, acSaveNo" on the close event does not
> work
>
> TIA
>
> Phil[/color]

Put
DoCmd.Close acReport, ReportName, acSaveNo
in your code, not in On Close of the report.

Bruno


Phil Stanton
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Prevent saving a report


Thanks Bruno but I cant see how that will work,


I have a number of reports which theoretically I can output as word
documents. I have a form with a list box that shows the reports. On pressing
the print button on the form, it adds code to the OnPrint sections of the
selectede report to initiate the output to Word routines. In order to output
the whole report to Word, the user has to go to the next page until they
reach the end. At that point I want to close the report. All the running
code is initiated by the printing process of the report. How can I detect
the end of the report and pass back control to the form that initiated the
proccess to do the The "DoCmd.Close acReport, me.Name, acSaveNo" on the
close event bit

Thanks

Phil





"Bruno Campanini" <bruno.XXXcampanini@tin.it> wrote in message
news:G6sid.262965$35.12186416@news4.tin.it...[color=blue]
> "Phil Stanton" <discussion@stantonfamily.co.uk> wrote in message
> news:41890243$0$102$65c69314@mercury.nildram.net.. .[color=green]
>> In code I am opening a report in deign view, adding code to the report to
>> output it to Word in an editable form. I then want t close the report but
>> not save the changes.
>> Is there any way or preventing the option to save changes from being
>> displayed (the answer is always no)
>>
>> The "DoCmd.Close acReport, me.Name, acSaveNo" on the close event does
>> not work
>>
>> TIA
>>
>> Phil[/color]
>
> Put
> DoCmd.Close acReport, ReportName, acSaveNo
> in your code, not in On Close of the report.
>
> Bruno
>
>[/color]


Bruno Campanini
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Prevent saving a report


"Phil Stanton" <discussion@stantonfamily.co.uk> wrote in message
news:418aa934$0$114$65c69314@mercury.nildram.net.. .[color=blue]
> Thanks Bruno but I cant see how that will work,
>
>
> I have a number of reports which theoretically I can output as word
> documents. I have a form with a list box that shows the reports. On
> pressing the print button on the form, it adds code to the OnPrint
> sections of the selectede report to initiate the output to Word routines.
> In order to output the whole report to Word, the user has to go to the
> next page until they reach the end.[/color]

I.e. in preview mode the user presses PagDown?
[color=blue]
> At that point I want to close the report. All the running code is
> initiated by the printing process of the report. How can I detect the end
> of the report and pass back control to the form that initiated the
> proccess to do the The "DoCmd.Close acReport, me.Name, acSaveNo" on the
> close event bit[/color]

I'm not sure to understand ok.
In any case if you are in the Form, you can't send
"DoCmd.Close acReport, me.Name, acSaveNo"
because Me.Name means, in the circumnstance,
the Form's Name.
Replace Me.Name with "ReportXXX" or a variable
containing the Report's Name.

In order to allow the Report's operations to
complete try adding DoEvents in your Form's
print button:

..............
..............
DoEvents
DoCmd.Close acReport, "ReportXXX", acSaveNo

Ciao
Bruno


Closed Thread