Detail.HasContinued problem

  • Thread starter Thread starter TK
  • Start date Start date
T

TK

I have some labels I need to show - or not show - in the page header based
on whether or not the detail section is printing on that page. I am using
the "HasContinued" property but it is not working at all. It constantly
returns false no matter what - if the details carry over to the next page -
I still get a return of false.
Any ideas?
Is there a better way to do this?
Thanks in advance.
TK
 
TK said:
I have some labels I need to show - or not show - in the page header based
on whether or not the detail section is printing on that page. I am using
the "HasContinued" property but it is not working at all. It constantly
returns false no matter what - if the details carry over to the next page -
I still get a return of false.


The Has/Will Continue properties only tell you if a single
detail section is split across a page boundary. Totally
useless for your (and most every other) purpose.

To do what you want, create a text box named txtDtlCount in
the detail section. Set its Control Source expression to =1
and its Running Sum property to Over Group.

Then add code to the Page Header section's Format event:

Me.lblContinued.Visible = (Me.txtDtlCount > 1)
 
Marsh,
Thanks for the idea. It seemed very simple and practical but unfortunately
it did not work.
Even though the next page does not have any detail section there is a group
footer which is printing on it and when the page header is formating it
seems as though it will always see the txtDtlCount number as greater than
one so it will want to print the very lables I am trying to hide.
I have tried a few variations on your idea but none seem to work because
there are times when the detail will continue to the next page.
Any ideas how to solve this problem?
Thanks in advance.
TK
 
TK said:
Thanks for the idea. It seemed very simple and practical but unfortunately
it did not work.
Even though the next page does not have any detail section there is a group
footer which is printing on it and when the page header is formating it
seems as though it will always see the txtDtlCount number as greater than
one so it will want to print the very lables I am trying to hide.
I have tried a few variations on your idea but none seem to work because
there are times when the detail will continue to the next page.


I guess I need to know more about what you're looking for
here.

Are you saying that you want a label to appear in the page
header of a group's second and subsequent pages, except when
the group's last page only contains the group's footer??

If that's a correct interpretation of your requirements, add
a text box named txtGrpCount to the group header section.
Set its Control Source expression to =Count(*). Then the
page header code could be:

Me.lblheader.Visible = (Me.txtDtlCount > 1) _
And (Me.txtDtlCount < Me.txtGrpCount)

If that's not what you want, please post back with more
details about what you do want. Maybe a few lines of
example output will help explain the different situations
you're trying to deal with.
--
Marsh
MVP [MS Access]


 
Marsh,
That's exactly what I wanted and your new solution worked perfectly.
Thanks a million!
TK

Marshall Barton said:
TK said:
Thanks for the idea. It seemed very simple and practical but unfortunately
it did not work.
Even though the next page does not have any detail section there is a
group
footer which is printing on it and when the page header is formating it
seems as though it will always see the txtDtlCount number as greater than
one so it will want to print the very lables I am trying to hide.
I have tried a few variations on your idea but none seem to work because
there are times when the detail will continue to the next page.


I guess I need to know more about what you're looking for
here.

Are you saying that you want a label to appear in the page
header of a group's second and subsequent pages, except when
the group's last page only contains the group's footer??

If that's a correct interpretation of your requirements, add
a text box named txtGrpCount to the group header section.
Set its Control Source expression to =Count(*). Then the
page header code could be:

Me.lblheader.Visible = (Me.txtDtlCount > 1) _
And (Me.txtDtlCount < Me.txtGrpCount)

If that's not what you want, please post back with more
details about what you do want. Maybe a few lines of
example output will help explain the different situations
you're trying to deal with.
--
Marsh
MVP [MS Access]


 
Marsh,
I hope you are still checking this.
I spoke too soon. I thought the problem was resolved but upon further
checking I found an anomoly which I can't seem to resolve.
If the page has only the group footer all is fine. If the page has more than
one detail printed all is fine. If the page has only one detail the labels
do not print. Here is the code I am using:
If Me.txtDtlCount > 0 And (Me.txtDtlCount < Me.txtGrpCount) Then
I turn on the labels visibility properties (there are 6)
else
visiblity is turned off
end if
I also have coding for setting page numbers based on the groups and have
forced the report to format twice to use an array for this purpose. I
thought that may be causing my problem, but even when I got rid of that I
still had the same results.
I look forward to any help you can give.
TK


Marshall Barton said:
TK said:
Thanks for the idea. It seemed very simple and practical but unfortunately
it did not work.
Even though the next page does not have any detail section there is a
group
footer which is printing on it and when the page header is formating it
seems as though it will always see the txtDtlCount number as greater than
one so it will want to print the very lables I am trying to hide.
I have tried a few variations on your idea but none seem to work because
there are times when the detail will continue to the next page.


I guess I need to know more about what you're looking for
here.

Are you saying that you want a label to appear in the page
header of a group's second and subsequent pages, except when
the group's last page only contains the group's footer??

If that's a correct interpretation of your requirements, add
a text box named txtGrpCount to the group header section.
Set its Control Source expression to =Count(*). Then the
page header code could be:

Me.lblheader.Visible = (Me.txtDtlCount > 1) _
And (Me.txtDtlCount < Me.txtGrpCount)

If that's not what you want, please post back with more
details about what you do want. Maybe a few lines of
example output will help explain the different situations
you're trying to deal with.
--
Marsh
MVP [MS Access]


 
Now I made two mistakes - first I posted the wrong code and then I wasn't
careful about where I was sending the correction :(
Anyway - here is the correct code I am using:
If Me.txtDtlCount >= 1 And (Me.txtDtlCount < Me.txtGrpCount) Then

TK



Marshall Barton said:
TK said:
Thanks for the idea. It seemed very simple and practical but unfortunately
it did not work.
Even though the next page does not have any detail section there is a
group
footer which is printing on it and when the page header is formating it
seems as though it will always see the txtDtlCount number as greater than
one so it will want to print the very lables I am trying to hide.
I have tried a few variations on your idea but none seem to work because
there are times when the detail will continue to the next page.


I guess I need to know more about what you're looking for
here.

Are you saying that you want a label to appear in the page
header of a group's second and subsequent pages, except when
the group's last page only contains the group's footer??

If that's a correct interpretation of your requirements, add
a text box named txtGrpCount to the group header section.
Set its Control Source expression to =Count(*). Then the
page header code could be:

Me.lblheader.Visible = (Me.txtDtlCount > 1) _
And (Me.txtDtlCount < Me.txtGrpCount)

If that's not what you want, please post back with more
details about what you do want. Maybe a few lines of
example output will help explain the different situations
you're trying to deal with.
--
Marsh
MVP [MS Access]


 
Sorry, TK, I thought I had a handle on this problem, but
things are not behaving in AXP as I remember them the last
time I did this kind of thing.

BTW, in the statement:
If Me.txtDtlCount > 0 And (Me.txtDtlCount < Me.txtGrpCount)
the first condition should be Me.txtDtlCount > 1, not 0.

You're correct, the second condition will not distinguish
whether the last detail is on the last page or the previous
page, sorry I misled you on that. Unfortunately, I can't
come up with a way for the page header events to tell which
case you are dealing with. AXP seems to have fixed(?) some
of the esoteric issues I thought used to work differently
than what I am now seeing.

I'm afraid I am going to have to give up on finding an
answer for you. Maybe someone else will contribute a useful
answer?
 
TK said:
I have some labels I need to show - or not show - in the page header based
on whether or not the detail section is printing on that page. I am using
the "HasContinued" property but it is not working at all. It constantly
returns false no matter what - if the details carry over to the next page -
I still get a return of false.


TK, this problem has been bugging me all week and I
**think** I came up with something that works, at least in
my tests. No guarantees because I don't think I covered all
combinations of KeepTogether, ForceNewPage, CanGrow, etc.
that seem to have a major impact on determining whether the
last detail is on the same page as the group footer or not.

The code goes in the Detail section's PRINT event (the
Format event doesn't seem to roll back the property settings
during retreats):

If Me.txtDtlCount < Me.txtGrpCount Then
' make the labels visible
Else
'make them invisible
End If

Also set the labels to invisible in design view to take care
of the first page.
 
Back
Top