Re: Re: Quick report Master/detail problem
Tom Nesler <[email protected]> Mon, 9 Sep 2002 07:10:16 -0700 (PDT)
| Newsgroups | gmane.comp.lang.delphi.quick-reports |
|---|---|
| Message-ID | <[email protected]> |
Hi Srini! --- ananth33 <[email protected]> wrote: > HI Tom Nesler, > Thx for your response.After writing code in detail band like this > > procedure TFrmSTAPPReport.QRDetailBeforePrint(Sender: TQRCustomBand; > var PrintBand: Boolean); > begin > if DDateEC = VarToStr( Query1.FieldByName > ('LEP_COMMENCE_DATE').Value) then > QRLblDEC.Enabled := True > else > QRLblDEC.Enabled := False; > Query1.Open; > Query1.FieldByName('LEP_COMMENCE_DATE').Value := DDateEc; > end; > > I am getting an error > Query1 : Cannot modify a readonly set. > > Can u help me out what could be the error. > I tried like giving Query1.Close & Query1.open Even then i am getting > > the same error. OK...A couple of questions first... The event you are using runs every time you are printing a detail band. Do you need to Rerun this query for every line of your report? Based on what I am seeing, you can't get a correct check on this line: > if DDateEC = VarToStr( Query1.FieldByName > ('LEP_COMMENCE_DATE').Value) then > QRLblDEC.Enabled := True >... If your Query is not 'opened' first. I would recommend placing the 'Open' section in the QuickRep1.BeforePrint event or maybe just set the Query1's Active property to True and let the form's own create statement run the query. 2nd...Do you want your field QRLblDec to be printed when your variable is the same as the query data? If you want to eliminate duplicates you need to have it print only if it is different. If the logic of your report requires you to leave everything the way it is, then move your '> Query1.Open;' line in front of the comparison statement like this: procedure TFrmSTAPPReport.QRDetailBeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean); begin Query1.Open; //<==== if DDateEC = VarToStr( Query1.FieldByName ('LEP_COMMENCE_DATE').Value) then QRLblDEC.Enabled := True else QRLblDEC.Enabled := False; Query1.FieldByName('LEP_COMMENCE_DATE').Value := DDateEc; end; If this does not fix the problem, you will need to ask this question in a regular Delphi Database newsgroup because it does not relate to QR. Good Luck! ===== Tom Nesler Live Long...Code Well... and Prosper! V __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com