Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Report footer problem (A2k2, SP2)

    Hi All,
    I've got a report which has a label in the report footer which I set the caption, in code, after the form is opened, like so
    '---------------------------------------------------------------------------
    DoCmd.OpenReport strReportNameInclusion, acViewPreview, strReportSourceInclusion
    Reports(rstIn![InclusionReport])!lblStatement.Caption = strInclusionMessage
    'where rstIn![InclusionReport] is taken from a 'default' report table
    '---------------------------------------------------------------------------
    My problem is that if the report is all on one page (as it should be) the label is blank (as it shouldn't be)!?!
    However, if the report goes over onto a second page the label is no longer blank and holds the statement it should.
    I'm a little (well, alot) baffled by this behaviour. <img src=/S/confused.gif border=0 alt=confused width=15 height=20>
    Does anyone have some insight into this?
    Thanks.

    gdr
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report footer problem (A2k2, SP2)

    The problem is that the OpenReport line opens the report in preview mode, i.e. displays the first page of the report. Then the caption of the label is set. Since the first page is already formatted and displayed, the new caption won't be visible until the next page (if it exists) is formatted for displaying.

    To get around this, you can pass the text for the caption in the OpenArgs argument of DoCmd.OpenReport, and set the caption in the OnOpen event of the report (OpenArgs for reports is new in Access 2002.)

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report footer problem (A2k2, SP2)

    Hi Hans,
    Thank you.
    I knew there had to be something happening with the order in which events were occurring. Also I didn't know that MS had added OpenArgs to reports. That lends itself to another set of concerns I have had and should greatly scale back the amount of reports which have to be designed for this project.
    Thanks again.

    gdr
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •