Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 705
  • Last Modified:

Change Label in Page Header on datareport

My datareport often spills on to 2 pages. What I want is on each page, to have the address. The most logical answer to this is to place the address in the page header, although as I'm sure many of you will know, you cannot have a bound control in the page header. To get round this, I am trying the following:

Private Sub DataReport_Initialize()
        With DataEnvironment1.rsCustomer
                 DataReport1.Sections("Section2").Controls("lblAddress").Caption = .Fields("Address")
        End With
End Sub

This works fine on the first record in the recordset. However, the first address in the recordset is on all pages (i.e Customer1's Address appears at the top of Customer2's report, when I need Customer2's address) when I want the address of the current record. is it possible to do this?
0
fuerteventura
Asked:
fuerteventura
1 Solution
 
TaconvinoCommented:
I used to run into this problem all the time.  The "easy" way to fix this is to design you report completely in your "Detail" section and tweak your query accordingly.  The hard way to deal with this is to use a MSDataShape provider.  This last option is hard because the documentation is not very good.  A data shape connection allows you to return a hierarchical recordset (meaning a header section and a detail section) which you can link directly to your data report.  Believe me, it's a pain the first time, but you get used to it after a while.  Here is a good example on how to use MSDataShape:

http://microsoft.apress.com/asptodayarchive/71737/creating-hierarchical-recordsets-with-the-data-shape-provider-part-i

How to use this with DataReport is another story.  Here is a good discussion on the matter:

http://www.xtremevbtalk.com/archive/index.php/t-130623.html

Hope this helps!
TCV
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now