Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print command won't work in Delphi 6 Enterprise.

Status
Not open for further replies.

delphiman

Programmer
Dec 13, 2001
422
ZA
Having returned to a previosely created (and successfully working) project I now find the project won't compile. Because Delphi doesn't recognize the "Print" command.

Could this be related somehow to the fact that my Windows 98 seems to be unstable? (After re-installing it some 5 times - using the "Compaq" disk that came with my PC - I am about to purchase a new PC with Windows 2000 on it.)

Terry
 
I know this may sound stupid but do you have a default printer set up on your PC ? Easy to forget if you're having to keep wiping and re-installing the machine.
 
I have now installed W2000 Professional on a new machine.
I have re-installed Delphi 6.
I have applied the first Delphi 6 Update.
I have made my printer default in the process.

Problem persists.
 
Delphi doesn't recognize the "print" command, was your project made in pascal or in an earlier delphi version? Delphi 1? S. van Els
SAvanEls@cq-link.sr
 
I reloaded a project (written previosely written in Delphi 6) wherin I used the following

procedure TfrmFuelTest.btnPrintFuelClick(Sender: TObject);
begin
QuickRepFuel.Print;
end;

Now I get an exception the word "Print".
 
So you get a run-time error. To me it looks like your problem lies in the QuickReport. In the original version where you using QuickReport standard or professional?
I assume that QuickRepFuel is a qr component, does QuickRepFuel.Preview work?

Is your quick report on the frmFuelTest form? or on another form?
If so try MyForm.QuickRepFuel.Preview
Is this other form in the autocreate list?
Maybe you need reinstalling QuickReports

Hope I have offered some clues.

Regards S. van Els
SAvanEls@cq-link.sr
 
This problem is still driving me nuts!
If only because it came from nowhere!

I guess it is "standard". It came with my Delphi 6 package.
See below.

Preview works.

I have no control over install/reinstall QuickReports. It comes packaged with Delphi 6 Enterprise and installs with it.

I have now created a fresh form.
Dropped a QuickReports component on that.
Created a detail band with one field on it.

It shows the Preview and prints from that.

But during Runtime the following routine (all of a sudden) won't work. I get a "Undeclared identifier: "Print" ... exception. Immediately on the . after QuickRepFuelUsed. Which I have never seen before.

procedure TfrmFuelTest.btnPrintFuelClick(Sender: TObject);
begin
QuickRepFuelUsed.Print;
end;

 
IT WORKS!!!

There have been times when I have wanted to be rude about Quick Reports. And this is another time!

Would anyone who has been following this thread beleive that the following works??

procedure TfrmFuelTest.btnPrintFuelClick(Sender: TObject);
begin
Form2.QuickRepFuelUsed.Print;
end;

Note the Form2 upon which I had dropped the Quick Report.
But which I didn't do before - and it worked like that!



 
Maybe you didn't set the datasource of the qrReport, the first time? In this case only a single record is shown, if selected. S. van Els
SAvanEls@cq-link.sr
 
In fact as a matter of practise I always use DataModules and the relevant DataModule was declared in the Uses clause of the QuickReport. And I set the DataSource from there.

The only difference (between the two applications) being that (in the first instance)I used a QuickReport directly out of "New/Other/New" in D6. (No form involved.)

In the second instance (as you hinted with your suggestion "Is your quick report on the frmFuelTest form? or on another form?") I created a new Form and dropped a QR on that. Which worked when I changed my RunTime statement to Form2.QuickRepFuelUsed.Print; Instead of just QuickRepFuelUsed.Print;

The mystery being why the first procedure worked (and still works) perfectly on my client's system.

I have found the Delphi/Quick Reports relationship to behave strangely (with Delphi 4) from time to time. I gues this is just another of those times.

Thanks for your help!

Terry.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top