modify report but don't save

  • Thread starter Thread starter Mal Stone
  • Start date Start date
M

Mal Stone

I'd like to use code to open a report in design view, change a few things,
then preview:
(this is in a class module)
Dim myReport As Access.Report
DoCmd.OpenReport _
ReportName:=mstrReportName, _
view:=acViewDesign
Set myReport = Reports(mstrReportName)
myReport.OrderBy = pstrOrderBy
myReport.OrderByOn = True

DoCmd.OpenReport _
ReportName:=mstrReportName, _
view:=acViewPreview

How do I avoid the Save Changes dialog box when the report gets closed, if I
don't want the user to be able to do that?
It's more than just the OrderBy - there are objects to be hidden, depending
on which user is logged in. I have it working with code in the report's
module, but I'd rather get it out of there.
Can I fool Access into thinking there are no changes?
Thanks for any ideas.
 
Mal Stone said:
I'd like to use code to open a report in design view, change a few things,
then preview:
(this is in a class module)
Dim myReport As Access.Report
DoCmd.OpenReport _
ReportName:=mstrReportName, _
view:=acViewDesign
Set myReport = Reports(mstrReportName)
myReport.OrderBy = pstrOrderBy
myReport.OrderByOn = True

DoCmd.OpenReport _
ReportName:=mstrReportName, _
view:=acViewPreview

How do I avoid the Save Changes dialog box when the report gets closed, if I
don't want the user to be able to do that?
It's more than just the OrderBy - there are objects to be hidden, depending
on which user is logged in. I have it working with code in the report's
module, but I'd rather get it out of there.
Can I fool Access into thinking there are no changes?
Thanks for any ideas.

You could make all these changes in the Open event of the Report and dispense
with having to open it in design view altogether. Changes made in that way are
automatically temporary and no attempt is made to save them.
 
Back
Top