Lionel,
"Report Preview" button works perfectly as it has only
the one line of code:
DoCmd.OpenReport ("rptInventory"), acViewPreview
Fine... except that this doesn't provide the same functionality as you
were trying to get before, i.e. the print dialog if you want to print
from the preview.
"Run the Report" button first produces a preview before
offering me the print dialog box. When I send to the
preinter, teh last one or two of thet 12 images on the
page do not print.
This is a difficult problem to diagnose, but I agree that it is likely
to do with system resources.
If I run the printing procedure through the Windows
File/Print... menu, I get the print dialog box, and then
straight to the printer, without preview and everything
works fine.
You could replicate this behaviour by the following code. However,
this assumes your application is set up with access permitted to the
database window, which in my experience is unusual.
DoCmd.SelectObject acReport, "rptInventory", True
DoCmd.RunCommand acCmdPrint
It seems to me that the extra step of first producing a
preview, and THEN spooling to the printer, uses up too
much of the resources of the computer or the printer.
So the question remains - how do I through the command
buttons, persuade the system to skip the preview that is
apparently inherent in opening the report, and get
straight to tthe print dialog box?
The preview isn't inherent in opening the report. It's just that the
printing function refers to the active object/window, and one way to
make the report the active window is to open it in preview.
If you need to have programmatic control over the options the users
will have, you can use something like...
Dim P1 As Integer
Dim Px As Integer
Dim Pq As Integer
Dim strPrinter As String
Dim UsualDefault As String
UsualDefault = GetDefaultPrinter
strPrinter = InputBox("Enter name of Printer to use", "Printer")
SetDefaultPrinter strPrinter
P1 = CInt(InputBox("Enter first page number", "From:"))
Px = CInt(InputBox("Enter last page number", "To:"))
Pq = CInt(InputBox("Enter the number of copies to print...",
"Copies", 2))
DoCmd.OpenReport "rptInventory"
DoCmd.PrintOut acPages, P1, Px, acHigh, Pq
SetDefaultPrinter UsualDefault
The default printer functions in the above code are based on code
written by Albert Kallal, and available at
http://www.attcanada.net/~kallal.msn/msaccess/msaccess.html
This is basically the reason I have broken up the table
into small managable pieces.
As I tried to intimate before, this thinking is misguided. Breaking
your data up into multiple tables will not affect this problem in any
way, not even to the most miniscule extent.
Thanks again for all your help and I look forward to
another genius solution from you.
- Steve Schapel, Microsoft Access MVP