Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Preventing a Report from Saving on Close (2007)

    I have a dynamic report that I generate depending on user selection criteria. When I close the report it is goes into design mode and the user has to close it again using the X in the upper right corner. The user is then asked if they want to save the report. If they save it and run the same report again the old fields are on the form and error messages pop-up.

    I have changed the close property to 'No' to try and disable the 'Close' button on the 'Print Preview' ribbon but it is not disabling as it does on other reports. I do have a 'Close' button that will close the report without saving it (created in Access 2003) that resides in the 'Add-Ins' tab but it is not apparent to the User to use it because the 'Preview' ribbon is open.

    Does anyone know how I can prevent the 'Close' button from working on the 'Preview' ribbon or force the 'Add-In' ribbon to be displayed instead of the 'Preview' ribbon?

    Thank you
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Preventing a Report from Saving on Close (2007)

    Do you open the report in design mode using code, then switch to preview mode? Normally, a report will only go into design mode upon closing if it was originally opened in design mode.

  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Preventing a Report from Saving on Close (2007)

    Yes, Since I create the fields on the report depending on the user selection. My code is attached:

    Is there a way to save this file as a new report and close the one I just modified. Then I could open the new report.

    Of course i would delete the report that was just created after they close it.
    Attached Files Attached Files
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Preventing a Report from Saving on Close (2007)

    You could use DoCmd.CopyObject to create a copy of the report before opening it.
    Then open the copy in design view, modify it and close it using DoCmd.Close with acSaveYes for the Save argument.
    Finally open the copy in preview mode.

  5. #5
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Preventing a Report from Saving on Close (2007)

    Thanks Hans,

    Sometimes I overlook the obvious.
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •