Using the HasContinued property

G

Guest

Hello,

I'm looking for some help with a sub-report problem in Access97. Here are
the basic things that may be relevant...

The sub-report has labels for it's columns in a group header (because report
headers won't print in sub-reports).
The sub-report is often large enough to force a new page on the main report.
The sub-report group header prints fine on the top of the new page because
the RepeatSection property of the group header is set to Yes.
The user would like to have an additional ID field printed in the group
header if it occurs on a new page, but not printed if there isn't a page
overflow.
I added the new field (named "HeaderName") to the group header section.

I was hoping to then set the Visible property for this field according to
the value of the HasContinued property for the group header section with the
following code (attached to the Format event of the group header section):

If
Reports!CandidateBioProfileSubInternational!Section(GroupHeader).HasContinued
= True Then
HeaderName.Visible = True
Else
HeaderName.Visible = False
End If

However, this code gives me an Access Run-Time error 2465. The message says:
"...can't find the field 'Section' referred to in your expression.".

I have not used the HasContinued property before. I ran across it in the
"Help" text, but there wasn't a lot of information. It sounded like it could
be used to do what I want, but I'm not sure. I don't know if I am trying to
use it incorrectly, or have the syntax messed up, or what...

Any suggestions would be greatly appreciated!! Either on how to correct the
above, or other ways to accomplish to same thing.

Thanks for your help.
 
G

Guest

Hi, Steve.

If I understand your situation, you are trying to find a workaround for
Access's inability to print report headers on the subreports that are printed
on multiple pages. Actually, there is a way. Here's a link to Microsoft's
quick solution that uses macros with the report and subreport:

http://support.microsoft.com/default.aspx?scid=kb;[LN];Q120907

Download the sample database file to see the solution in action. In case
you have the time and motivation, you might want to convert the macros to VBA
code for future software maintenance on your application. (Hints: Instead
of calling macros in the events in the "Properties" dialog box of the report
and subreport, you would call public functions -- and they must be functions,
not subroutines -- that you have defined in a module.)

Just in case you had an additional reason for wanting to add the text box
named "HeaderName" in the report's or subreport's group header section for
whenever you have multiple pages for the subreport, you would need to change
the syntax slightly to avoid the run-time error:

If (Reports!CandidateBioProfileSubInternational.GroupHeader0.HasContinued)
Then

.... where GroupHeader0 is the first section to be grouped on in the report.
When you write your own code, don't use the field name that you assigned to
the section for grouping the report on. Open up the report in design view
and left-click on the header you are interested in. Then right-click on the
header to open the pop-up menu and select "Properties" to open the
"Properties" dialog box. Select the "Other" tab and read the "Name" property
that you will use in your code. You'll see something like GroupHeader0,
GroupHeader1, or GroupHeader2.

Note that the above code works on the report in the GroupHeader0_Format and
Report_Page subroutines, and in the subreport's Report_Page subroutine, but
not in the subreport's GroupHeader0_Format subroutine.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question, please sign in to Microsoft's
Online Community and mark these posts, so that all may benefit by filtering
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top