Connecting Tech Pros Worldwide Help | Site Map

How to supress message when dynamically setting Report recordsource

ZRexRider
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi,

I'm using MS Access 2003 and have developed a report that is called
from a form that customizes a SQL statement to produce various results.

DoCmd.OpenReport conReportName, acViewDesign

Set rpt = Reports.Item(conReportName)
With rpt
.Visible = True
.RecordSource = strSQL ' customized sql string
End With

Everything works correctly - report content always reflects the SQL
statement passed so I'm happy with that but.....

When I close the report I get prompted with the following:

"do you want to save changes to the design of report"

I've placed "DoCmd.SetWarnings False" on various events of the report
..Close, .Deactivate but realize now this prompt fires before either of
these events.

Any ideas?

Thanks

Rick Brandt
Guest
 
Posts: n/a
#2: Nov 13 '05

re: How to supress message when dynamically setting Report recordsource


ZRexRider wrote:[color=blue]
> Hi,
>
> I'm using MS Access 2003 and have developed a report that is called
> from a form that customizes a SQL statement to produce various
> results.
>
> DoCmd.OpenReport conReportName, acViewDesign
>
> Set rpt = Reports.Item(conReportName)
> With rpt
> .Visible = True
> .RecordSource = strSQL ' customized sql string
> End With
>
> Everything works correctly - report content always reflects the SQL
> statement passed so I'm happy with that but.....
>
> When I close the report I get prompted with the following:
>
> "do you want to save changes to the design of report"
>
> I've placed "DoCmd.SetWarnings False" on various events of the report
> .Close, .Deactivate but realize now this prompt fires before either of
> these events.[/color]

There is no reason to open the Report in design view to apply a dynamic
RecordSource. Just move your code to the Open event of the report. No
design view = no save prompt.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



Closed Thread