Label showing in Print Preview does not print

  • Thread starter Thread starter John Morgan
  • Start date Start date
J

John Morgan

I am using Access 2000 and I am using code derived from page 688 of
Access 2000 Developers Handbook(Getz et al)

The intention is that a label with a 'continued' caption is visible
whenever a group extends on to a new page otherwise it remains
invisible.

In print preview the report shows up properly with the 'continued'
label visible in the right places. However when the form is printed
out the label does not show at all though everything else prints
properly.

The code I am using
Private Sub GroupHeader1_Print(Cancel As Integer, PrintCount As
Integer)

' Only show the Continued label if the
' time field hasn't changed since
' the last time you printed it.
Static strTime As String

lblContinued.Visible = (time = strTime)
'lblContinued.Visible = True
' Store away the current time.
strTime = time
End Sub
 
John said:
I am using Access 2000 and I am using code derived from page 688 of
Access 2000 Developers Handbook(Getz et al)

The intention is that a label with a 'continued' caption is visible
whenever a group extends on to a new page otherwise it remains
invisible.

In print preview the report shows up properly with the 'continued'
label visible in the right places. However when the form is printed
out the label does not show at all though everything else prints
properly.

The code I am using
Private Sub GroupHeader1_Print(Cancel As Integer, PrintCount As
Integer)

' Only show the Continued label if the
' time field hasn't changed since
' the last time you printed it.
Static strTime As String

lblContinued.Visible = (time = strTime)
'lblContinued.Visible = True
' Store away the current time.
strTime = time
End Sub


That code seems ambiguous to me, is tme the built-in
function or a field in your table?

Either way, I think there may be some subtle issues involved
with it so I recommend using a different approach. Add a
text box named txtDetailCount to the detail section. Set
its control source expression to =1 and its RunningSum
property to Over Group. Then the code in the header's
Format event would just be:

lblContinued.Visible = (txtDetailCount > 1)
 
That code seems ambiguous to me, is tme the built-in
function or a field in your table?



Thank you Marshall for your reply.

time is a field in the query which is the datasource for the report.

The original code from the Handbook from which I derived my slightly
amended version is shown below and appears to be the same.

The fundamental aim of this code is to get over the difficulties with
the HasContinued runtime property in Access 2000. The problem is, to
quote the Handbook 'you cannot check it from the location where it
would be most useful -when you're printing the page header' Do you
happen to know whether Access2002 is better in this respect?

This is the original code:
(CompanyName is a field name )

' From Access 2000 Developer's Handbook, Volume I
' by Getz, Litwin, and Gilbert (Sybex)
' Copyright 1999. All rights reserved.

Private Sub GroupHeader0_Print( _
Cancel As Integer, PrintCount As Integer)
' Only show the Continued label if the
' CompanyName field hasn't changed since
' the last time you printed it.
Static strCompany As String

lblContinued.Visible = _
(CompanyName = strCompany)

' Store away the company name you just printed.
strCompany = CompanyName
End Sub

Best wishes, John Morgan
 
John said:
Thank you Marshall for your reply.

time is a field in the query which is the datasource for the report.

Time is an Access reserved word. If you added the time text
box to the report by dragging it from the field list, then
there are three tings named Time, the built-in function, the
field in the report's record source and the text box. The
code you posted is bound to be confused about which one you
want to use. I suspect that your problem is because Access
guessed wrong about what you want and is using the time of
day instead of the value in the field or text box. To make
this work you should change the name of the field and text
box to something else. The least you can do is qualify the
name with its containing object, in this case the report
object Me:

lblContinued.Visible = (Me!time = strTime)
strTime = Me!time

I still think there are other issues using this technique.
Did you try my suggested alternate logic?
 
Thank you Marshall for your very helpful reply.

No I did not see your code snippet which happened to be just off the
screen - unforgivable of me I know!- but in my eagerness to get back
to you I missed it.

I will try your method . Otherewise a major point you've picked up for
me is 'time' being a reserved keyword. It occurs to me that another
way round it is to use an alias in the SQL query string.

Anyway I will work on it and, again, I do appreciate your help,

Best wishes, John Morgan
 
Thanks Marshall,

Got it properly going based on your suggested method and indeed have
now got (continued) also showing on the bottom of the previous page
-just what I wanted.

Best wishes, John Morgan
 
John said:
Thanks Marshall,
Got it properly going based on your suggested method and indeed have
now got (continued) also showing on the bottom of the previous page
-just what I wanted.


Way to go, John!

Glad to have been able to help you out,
 
Back
Top