Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

AV when click Print icon in Preview

edited November 2002 in End User
Environment:
Delphi 6, RB 6.03, InterBase/Firebird, IBObject, Win2K network and
server, access to Delphi application via Citrix server.

Problem: When we preview any report, the print preview looks fine, the
data is all there, but when we click the printer icon, we get an
immediate access violation. It occurs at line 1350 of ppProd:

FPrintDialog := CreatePrintDialog;
DoOnPrintDialogCreate;
<----- Access violation : The printer dialog appears +/-
simultaneously >
if (FPrintDialog <> nil) then
begin
lModalResult := FPrintDialog.ShowModal;
DoOnPrintDialogClose;


Int the application we set Report.PrinterSetup.PrinterName to 'Current'
or 'Default'; (We tried each.). But the Windows printers on the system
do not show up in the printer list: If the printerName is set to
'Default,' the only printer in the printer list is "Default." If the
printerName is set as "Current," the Dialog did display one printer name
from the system's installed printers (HP4000...PostScript...) , although
it was a random selection, it being neither anybody's default printer,
nor the current (since we have done no printing).

FWIW, the captions of the labels next to "Type" and "Where" on the Print
dialog have the label names: "lbPrinterTypeDesc" and
"lbPrinterWhereDesc," rather than any data.

The report is a component on the main form (not a dataModule).
SavePrinterSetup=False;
For testing we call Report.Print thus:

with rpMainReports do begin
PrinterSetup.PrinterName := 'Current'; // Also tried "Default";
Template.DataBaseSettings.Name := 'NameList1';
Template.LoadFromDatabase;
for i := 0 to AutoSearchFieldCount - 1 do
AutoSearchFields[i].SearchExpression:=IntToStr(124);
//hard-coded param value for test
ShowAutoSearchDialog:=false;
DeviceType:=dtScreen;
Print;
end;

I can't find any code for the OnShow event for FPrintDialog in ppProd.
We have not coded _any_ event handlers for the report. Why might we be
getting the AV, in the context of a failure also to find/display the
system installed printers?

RBuilder.ini is located in the same directory as the application, so
read/write rights/permissions should not be an issue. Someone mentioned
that in a Citrix context.

The Same application running on several other LANs has no problems at
all printing the same reports.


Dennis McFall

Comments

  • edited November 2002
    Make sure that there is a printer installed on that machine as the default
    printer. Can you print to it using MS Word or other application? Perhaps
    the printer driver is corrputed. Reinstall the printer driver and use the
    latest one from the printer manufacturer's website..

    Do you have any code in the OnPritDialogCreate of the report that would
    cause a problem?

    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.