Solved

Change Label in Page Header on datareport

Posted on 2007-11-14
1
658 Views
Last Modified: 2013-12-20
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
Comment
Question by:fuerteventura
1 Comment
 
LVL 6

Accepted Solution

by:
Taconvino earned 500 total points
ID: 20298526
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now