locked
Disable Print RRS feed

  • Question

  • Hi All,

    I have an MS Access 2003 report which causes problems when you try to print the report but it works ok in preview. Is it possible to disable the print options when previewing a report?

    Many thanks!
    Friday, August 6, 2010 2:37 PM

Answers

  • If it we me, I would use VBA code to create most is not all the data into temp tables before opening the report. Especially any complex queries get appended to temp tables.  This way the report/sub report's record sources are very simple. I find this alo makes the report load a lot faster and can be eaily printed from the preview.

    I split all my databases. For temp tables like this, I use a local backend in the same folder as the front end..

    • Marked as answer by Fafafaalex Friday, August 13, 2010 5:43 AM
    Thursday, August 12, 2010 2:50 PM

All replies

  • Does the report print fine if is is printed directly to the printer without first previewing? 

    What is the problem with printing if you preview then print? Every time I have seen this issue is when there was VBA code used to do calculations and the variable were not  initialized in the code to zero. Why is this important? Because when the report is printed from the print preview, all the VBA code is run again.

     

    Friday, August 6, 2010 6:08 PM
  • What kind of "problems"?
    -Tom. Microsoft Access MVP
    Saturday, August 7, 2010 4:23 AM
  • I have mentioned this before on the forums and got nowhere with it. Basically I get the error 'too many databases open' or something like that several times. I have spent ages on this a long time ago (redoing queries etc in different ways) and nothing I did worked so I don't really want you to worry about the 'why'. It is a very complicated report full of subreports (which display data in different ways hence no defined relationship between main report and subreports) and I just think that Access is not designed to cope with it. One of the subreports it has problems with has a chart, another is based on a union query and another just a calculation I think - if printed it produces the same error for each subreport and prints the report excluding these objects.

    I have got round the problem by splitting the report into three separate reports which are the ones used to send to the printer, done this way they print fine without any errors even though they are exactly the same structure etc (copied and pasted to 3 reports instead of just the one). But for preview purposes only the error doesn't seem to occur so I have one whole report which they can use for this to make it view better on screen. BUT it will error if they try to print from this version, I have asked them not to do so but you know what users are like ;-). Therefore I just want to know if there is a way via code to prevent sending to the printer?

    We have at least 30 of these reports (and subreports) all the same format/structure but different language translations for all the countries we work in.

    Thanks, Sue

     

    Thursday, August 12, 2010 10:06 AM
  • If it we me, I would use VBA code to create most is not all the data into temp tables before opening the report. Especially any complex queries get appended to temp tables.  This way the report/sub report's record sources are very simple. I find this alo makes the report load a lot faster and can be eaily printed from the preview.

    I split all my databases. For temp tables like this, I use a local backend in the same folder as the front end..

    • Marked as answer by Fafafaalex Friday, August 13, 2010 5:43 AM
    Thursday, August 12, 2010 2:50 PM
  • Thanks, I will look at this - had thought of it myself but I thought that storing data was always a bad idea. I guess if I just create the data if a user requests the report so it is refreshed each time automatically then it might be ok...
    Tuesday, August 17, 2010 10:19 AM
  • Thanks, I will look at this - had thought of it myself but I thought that storing data was always a bad idea. I guess if I just create the data if a user requests the report so it is refreshed each time automatically then it might be ok...

    I may have not been clear. I am  not suggestion storing the data. What I am suggestion is that you use temporary tables to accumulate the data for the report. This way the report is not running and/or rerunning a lot of complex queries.

    What I am suggesting is this:

    1) empty out the temp tables. 
    2) run VBA code and/or queries to append the data into the temporary tables.Basically de-normalizing the data into temporary tables.
    3) open the report. The report's record source will be based on the temporary tables.
    4) When the report closes, empty the temporary tables.

     

    Tuesday, August 17, 2010 8:45 PM
  • Yes I understood that from the first message, thanks :-)
    Friday, August 20, 2010 1:01 PM