Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Stop report from saving (2003 SP2)

    I have a report that is altered by code each time it is opened. There is no need to save the report, indeed I would like it not to be saved to stop the Db file size increasing. Is there any way of having the report not ask to be saved when closed?
    Putting
    DoCmd.Close acReport, Me.Name, acSaveNo
    in the OnClose event doesn't do it. Any other ideas?
    Regards,
    Peter

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Stop report from saving (2003 SP2)

    There shouldn't be any need for that. I don't think any changes you make via code in report format are saved when report is closed normally (such as when it finishes printing, or you just close a print preview).
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Stop report from saving (2003 SP2)

    Thanks Mark. The report prompts to be saved, so I would assume that there is something to be saved - which would result in the Db file size increasing.
    Regards,
    Peter

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

    Re: Stop report from saving (2003 SP2)

    It's useless to put DoCmd.Close in the On Close event, because this event occurs when the report is being closed.

    You could set the Close Button property of the report to No, so that the user cannot click the close button (the "x") in the upper right corner of the report.
    Create a custom toolbar with the buttons you want (such as Print, for example), and a custom close button that calls a function in a standard module that closes the report, e.g.

    Public Function CloseReport()
    DoCmd.Close acReport, Screen.ActiveReport.Name, acSaveNo
    End Function

    This is not watertight - the user can still press Ctrl+F4 to close the report.

  5. #5
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Stop report from saving (2003 SP2)

    >>The report prompts to be saved, so I would assume that there is something to be saved - which would result in the Db file size increasing.<<

    That's strange. I frequently do changes to reports in code (changing location of controls, changing controlsource of controls and grouping levels, etc.), and I never get a "Save?" prompt. Do you have a Docmd.Close in your code already? If so, take it out.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  6. #6
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Stop report from saving (2003 SP2)

    Another thought just occurred to me. Exactly how/where is your code that is changing the report design? Are you opening the report in design mode, or is your code just in report's Open event?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  7. #7
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Stop report from saving (2003 SP2)

    Thanks Hans. Sadly too far out of the ordinary for the users.
    Regards,
    Peter

  8. #8
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Stop report from saving (2003 SP2)

    The report is opened in design mode (DoCmd.OpenReport "rptBKzRoll", acViewDesign), the alterations are made, and then it is opened in Preview mode (DoCmd.OpenReport "rptBKzRoll", acPreview).
    Regards,
    Peter

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

    Re: Stop report from saving (2003 SP2)

    Why? Can't they click a toolbar button? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    I fear you're stuck then. Why don't you set the (frontend) database to Compact on Close? You wouldn't have to worry about the database size increasing.

  10. #10
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Stop report from saving (2003 SP2)

    Compacting on close takes 26 seconds (8.4 Mb). Too long for impatient users (and me). I frequently decompile then compact, but it still takes the same length of time.
    I was clutching at straws. So as you say, I'm stuck. Thanks anyway.
    Regards,
    Peter

  11. #11
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Stop report from saving (2003 SP2)

    Aha! You need to close the design view prior to opening with in Preview. In these situations, my code looks like this:

    DoCmd.OpenReport strRpt, view:=acViewDesign, windowmode:=acHidden
    ' make changes here
    DoCmd.Close acReport, strRpt, acSaveYes
    Docmd.OpenReport strRpt, view:=acViewPreview
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  12. #12
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Stop report from saving (2003 SP2)

    BTW, exactly what changes are you making in code? If you can move these changes to the report itself (usually in the report's Open event), then you wouldn't have to Open/Save report first, eliminating the bloat problem.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  13. #13
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Stop report from saving (2003 SP2)

    Ah yes, but I'm still saving the report, when there's no need to.
    Regards,
    Peter

  14. #14
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Stop report from saving (2003 SP2)

    The report is roll. Names in left col, dates in top row. Grid in the middle connecting the Cols & Rows is for showing attendance. The report can have up to 30 columns of dates, but this is reduced depending on the users selected date range. The opening code reduces the width of non needed columns and moves them to the right of the used columns. then reduces the report width. Then the top row label Captions are set and the grid textbox's ControlSources are set. This is called from a button on the roll form.
    If you feel that moving the code to the reports OnOpen event would overcome the problem, I could easily do that. But if I did, I would still have changed the report and wouldn't it then still prompt to be saved on closing?
    Regards,
    Peter

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

    Re: Stop report from saving (2003 SP2)

    No, since you wouldn'yt be modifying the design of the report, only the runtime properties.

    See <post:=134,439>post 134,439</post:> for an example (in Access 97 format, zipped)

Page 1 of 2 12 LastLast

Posting Permissions

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