?
Solved

Change Label in Page Header on datareport

Posted on 2007-11-14
1
Medium Priority
?
697 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
Taconvino earned 2000 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

719 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