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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quickreport qrdbtext component changing mask 1

Status
Not open for further replies.

garwain

Programmer
Jan 30, 2002
461
CA
I need to find a way to change the mask on a qrdbtext field while generating a report. Basically what I have is a purchase order, and if the price of an item is less than a dollar, I need to display 4 decimal places, otherwise I need 2 decimal places.

I have tried modifying the mask in the dbtext's onprint event, but if it changes the mask, then the report just stops printing on that line, without displaying a price.

Any ideas on how I can accomplish this would be appreciated.
 
I think I've been into this situation before..
Let see.. Instead using QRDBText, you should use QRLabel.
And BeforePrint event of the Band that contain this QRLabel will be:
Code:
procedure TSomeReportForm.BandBeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
begin
  {if Amount less than a Dollar then
     QRLabel1.Caption:= FormatCurr('The format you want with 4 decimal places', Field Value)
   else
     QRLabel1.Caption:= FormatCurr('The format you want with 2 decimal places', Field Value);
  }
end;

the code is just an explanation, not actual code. I hope you get the idea..
 
Thanks. I haven't had a chance to try it, but that definatly point me in a new direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top