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

Very Simple Beginner question

edited July 2002 in General
I am very new report builder. I have professional version 6 for
Delphi 6. I would like to change the value of caption at print time.
Based on user chooses, i will overwrite label caption before executing
print. I'm getting errors when attempting the following:

procedure TfrmClients.SpeedButton20Click(Sender: TObject);
var mTempText : string;
begin
mTempText := 'Hello World';
frmRpt.rbrClientsContactFax.ppLblFaxFrom.caption := mTempText
frmRpt.rbrClientsContactFax.Print;
end;

i know this is very simple code, sorry, im just beginning!!

it can print if i comment out the caption assignment, so i know it's
calling and printing correctly, now i just want to chagne print
output! :

thanks you for helps!

Comments

  • edited July 2002
    Hi Taticus,

    what is the error?

    regards,
    Chris Ueberall;

  • edited July 2002
    The caption assignment should be
    frmRpt.ppLblFaxFrom.caption := mTempText;

    If you look at the form you'll see that the label is an object generated as
    part of the form and not as part of the report object. Take a look at the
    Developer's Guide in RBuilder\Developer's Guide which has a section on
    developing a report in code. This should give you a good idea of how to
    manipulate properties of report components programatically.


    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited July 2002
    just doesn't compile. It doesn't like referencing ppLblFaxFrom (a
    label that hold person's name who's faxing) outside of report. I am
    Using form and that's OK becuase I actually cause report to print.
    so I've set up linkage to report ok, I just want to change labels on
    report OUTSIDE of report, right before print.

    [Error] frm_Clients.pas(649): Undeclared identifier: 'ppLblTEST'

    procedure TfrmClients.SpeedButton20Click(Sender: TObject);
    var mTempText : string;
    begin
    mTempText := 'Hello World';
    frmRpt.rbrClientsContactFax.ppLblTEST.caption := mTempText;
    frmRpt.rbrClientsContactFax.Print;
    end;

    I change code slighly with TEST

    THanks ! for the reply!


    On Wed, 17 Jul 2002 12:25:31 +0200, "Chris Ueberall [TeamDM]"
  • edited July 2002

    I will read under "developing a report in code" and see what i can
    find out.

    thank you!

    ps is this easy thing? or require lots of code. seem simple type of
    fucntionality.



    On Wed, 17 Jul 2002 09:20:16 -0500, "Alexander Kramnik \(Digital
  • edited July 2002
    I just read this section (Page 83-85) and that show how to make a
    report from just code, and this is not what I am doing. All i need is
    to make a label on existing report change before printing. Like they
    will type into Edit Box their name, and now it shows up on Fax Cover
    page. This is not in database though, or I would just use ppDB aware
    controls. Seem easier to add field to database and use dbText control
    on report than just change label right before printing? Do not want
    to add field to database if not needed




    On Wed, 17 Jul 2002 18:40:29 GMT, taticus@attglobal.net (Taticus)
  • edited July 2002
    Hi Taticus,


    you must have overlooked Alexander's solution!



    The caption assignment should be
    frmRpt.ppLblFaxFrom.caption := mTempText;

    If you look at the form you'll see that the label is an object generated as
    part of the form and not as part of the report object.



    regards,
    Chris Ueberall;
  • edited July 2002
    Chris you are right! Alex I am sorry I did missing it!!

    My problem is I do not have to specify the name of report!

    no good:
    frmRpt.rbrClientsContactFax.ppLblFaxFrom.caption := mTempText;

    good
    frmRpt.ppLblFaxFrom.caption := mTempText;


    Thank you everyone, sorry I missed solution earlier. I hope someone
    else helps from this question:)

    Taticus



    On Thu, 18 Jul 2002 13:00:52 +0200, "Chris Ueberall [TeamDM]"
This discussion has been closed.