Solved

Change Label in Page Header on datareport

Posted on 2007-11-14
1
654 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

760 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

18 Experts available now in Live!

Get 1:1 Help Now