Solved

Change Label in Page Header on datareport

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

829 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