Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing Report (Access 97) in Preview Mode with no save

Status
Not open for further replies.

epoirier

Programmer
Feb 22, 2002
37
CA
Hi,

I use a GroupLevel to change the Sort of the report because some report need different sort and i don't want to make duplication of this report

Here my code:

DoCmd.OpenReport strRptName, acDesign

Reports(strRptName).GroupLevel(0).ControlSource = "ID_NO"
Reports(strRptName).GroupLevel(0).SortOrder = 0

Etc..

DoCmd.OpenReport strRptName, acPreview

But when a preview this report when a close the report the system always ask me to save the modification. It is possible to remove this message ? I know the command is working fine when i send to printer:

DoCmd.OpenReport strRptName, acNormal
DoCmd.Close acReport, strRptName, acSaveNo

It is possible to remove temporaly the saving message box in the via options or api windows ?

Thanks for your help,

Eric
 
I don't think there's any way to avoid the message, since you're making the changes in design mode. However, you can modify your code to make the changes in the report's Open event, and you won't have a problem.

Create a pair of global variables to hold the values you need to put in ControlSource and SortOrder. Find all the places that the report is opened in either preview or report view, and for each one, set the global variables to the values you need. In the report, create an Open event procedure that simply copies the global variables into the GroupLevel properties. Rick Sprague
 
Is very strange, don't put this exemple in the book Access guide du développeur 97. This is a better solution.

Thanks you Rick Sprague.


Eric
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top