J
Jeff Conrad
Hi,
This message is mostly for Fred, but anyone else is most welcome to join in.
I've been using some code supplied by Fred to print multiple copies of
address labels and to start at a specific position on the first page. I've
been using it for a long time with no problems, in fact I've even passed on
the code to other NG posters. Recently, however, I stumbled across something
VERY weird about this only because I never tried it before!
The code will prompt the user for the starting position as well as how many
copies of each label to print. I took this a step further and make a real
slick form to gather this information instead of having the prompts. The
form has a graphical display of 30 labels on the sheet and you just click
which one you want to start on. Then the user enters how many copies of each
with the default set at one. I thought this form was the cause of the
"weirdness" (explained in a minute), but it's not. Just using the following
steps make it happen every time.
Here are the steps to reproduce:
1. Setup just as Fred describes:This will permit you to enter the number of times to
repeat the labels, as well as skip missing label positions
on an already used sheet.
First make sure your label report properly prints 1 label
per record.
Then add a Report Header to the label report.
Add 3 unbound text boxes to the header.
1) Set the Control Source to:
= [Skip how many]
Name this control SkipCounter
2) Leave the second control unbound.
Name this control SkipControl
3) Set the third control's Control Source to:
=[Repeat how many]
Name it RepeatCounter
Next code the Report Header OnFormat event:
Private Sub ReportHeader_Format(Cancel As Integer,
FormatCount As
Integer)
[SkipControl] = "Skip"
Cancel = True
End Sub
=======
Now code the Detail OnPrint Event:
(Note that intMyPrint is Static!!)
Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)
Static intMyPrint As Integer
If PrintCount <= [SkipCounter] And [SkipControl] = "Skip"
Then
Me.NextRecord = False
Me.PrintSection = False
intMyPrint = 0
Else
[SkipControl] = "No"
Me.PrintSection = True
Me.NextRecord = True
intMyPrint = intMyPrint + 1
If IsNull([RepeatCounter]) Then
ElseIf intMyPrint Mod [RepeatCounter] = 0 Then
Me.NextRecord = True
intMyPrint = 0
Else
Me.NextRecord = False
End If
End If
End Sub
=========
When you run the report, it will ask how many labels to
skip, then how many times to repeat each label.
FredG
2. OK, in my test data I have 16 vendors, but I don't think it matters how
many. I have 30 labels on a sheet, but again I don't think this is
significant either. For the sake of testing please try and match these
requirements.
3. Open the report from the database window and select any number for
starting position and only 1 repeat. Should be one page no problems. Close
the report.
4. The MAGIC number for me is ANYTHING after 3 pages in length for the
report. So, for example, if I say 0 starting and 4 repeats then the
"weirdness" happens!!! OK, Jeff what "weirdness"!!
You must do this EXACTLY like I say!!
First Test:
- Open the report and select 0 and then 4
- At the bottom left corner are the page selectors
- BEFORE DOING ANYTHING ELSE click the far right one that should take you to
the last page
- You should see a slight screen flicker, but the page does NOT change.
You're still on page 1!
- Think that's weird? Now try clicking the button that will advance the page
one at a time. The number will change to 2 and the new labels will also
appear. Fine. Now keep GOING one page at a time and see what happens!!!! The
labels displayed do NOT change AND the number will just keep going and going
and going to infinity!!! Even if I change the view to show six pages at a
time it will show six pages of the same thing over and over and over even
though I know it is only a three page report!!! Weird! If I hit the last
page button it just goes bonkers.
Second Test:
- Open the report and select 0 and then 4 again
- Advance the report by one page at a time WITHOUT hitting the last page
button. The numbers correctly stop at 3 and the labels displayed are fine.
So what's the problem with the last page button and this code?
5. I was VERY afraid to actually hit the print button for fear of an endless
stream of pages coming out! But, to complete the test I bit the bullet and
hit print. It correctly printed only 3 pages even though my screen said 99
pages at that moment! Whew!
6. One last note before everyone goes "I'm not seeing this." This
"weirdness" only happens on Access 97 and 2000. I do NOT see this behavior
on Access 2002 or 2003. I have done a LOT of testing on various operating
systems and page numbers, but it only occurs on 97 and 2000. For the last
two versions no matter how big the report was (and I tried really big)
clicking the last page button correctly took me to the last page after a few
seconds. And yes, I believe each system had the latest service packs and Jet
updates.
So my questions:
1. Can anyone else see this on 97 or 2000?
2. Why does this problem happen on 97 and 2000?
3. Anyway around this? The users want to know how many pages are going to
print, but they're afraid to hit the print button!
Thanks for any comments and/or thoughts.
Jeff Conrad
Bend, Oregon
This message is mostly for Fred, but anyone else is most welcome to join in.
I've been using some code supplied by Fred to print multiple copies of
address labels and to start at a specific position on the first page. I've
been using it for a long time with no problems, in fact I've even passed on
the code to other NG posters. Recently, however, I stumbled across something
VERY weird about this only because I never tried it before!
The code will prompt the user for the starting position as well as how many
copies of each label to print. I took this a step further and make a real
slick form to gather this information instead of having the prompts. The
form has a graphical display of 30 labels on the sheet and you just click
which one you want to start on. Then the user enters how many copies of each
with the default set at one. I thought this form was the cause of the
"weirdness" (explained in a minute), but it's not. Just using the following
steps make it happen every time.
Here are the steps to reproduce:
1. Setup just as Fred describes:This will permit you to enter the number of times to
repeat the labels, as well as skip missing label positions
on an already used sheet.
First make sure your label report properly prints 1 label
per record.
Then add a Report Header to the label report.
Add 3 unbound text boxes to the header.
1) Set the Control Source to:
= [Skip how many]
Name this control SkipCounter
2) Leave the second control unbound.
Name this control SkipControl
3) Set the third control's Control Source to:
=[Repeat how many]
Name it RepeatCounter
Next code the Report Header OnFormat event:
Private Sub ReportHeader_Format(Cancel As Integer,
FormatCount As
Integer)
[SkipControl] = "Skip"
Cancel = True
End Sub
=======
Now code the Detail OnPrint Event:
(Note that intMyPrint is Static!!)
Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)
Static intMyPrint As Integer
If PrintCount <= [SkipCounter] And [SkipControl] = "Skip"
Then
Me.NextRecord = False
Me.PrintSection = False
intMyPrint = 0
Else
[SkipControl] = "No"
Me.PrintSection = True
Me.NextRecord = True
intMyPrint = intMyPrint + 1
If IsNull([RepeatCounter]) Then
ElseIf intMyPrint Mod [RepeatCounter] = 0 Then
Me.NextRecord = True
intMyPrint = 0
Else
Me.NextRecord = False
End If
End If
End Sub
=========
When you run the report, it will ask how many labels to
skip, then how many times to repeat each label.
FredG
2. OK, in my test data I have 16 vendors, but I don't think it matters how
many. I have 30 labels on a sheet, but again I don't think this is
significant either. For the sake of testing please try and match these
requirements.
3. Open the report from the database window and select any number for
starting position and only 1 repeat. Should be one page no problems. Close
the report.
4. The MAGIC number for me is ANYTHING after 3 pages in length for the
report. So, for example, if I say 0 starting and 4 repeats then the
"weirdness" happens!!! OK, Jeff what "weirdness"!!
You must do this EXACTLY like I say!!
First Test:
- Open the report and select 0 and then 4
- At the bottom left corner are the page selectors
- BEFORE DOING ANYTHING ELSE click the far right one that should take you to
the last page
- You should see a slight screen flicker, but the page does NOT change.
You're still on page 1!
- Think that's weird? Now try clicking the button that will advance the page
one at a time. The number will change to 2 and the new labels will also
appear. Fine. Now keep GOING one page at a time and see what happens!!!! The
labels displayed do NOT change AND the number will just keep going and going
and going to infinity!!! Even if I change the view to show six pages at a
time it will show six pages of the same thing over and over and over even
though I know it is only a three page report!!! Weird! If I hit the last
page button it just goes bonkers.
Second Test:
- Open the report and select 0 and then 4 again
- Advance the report by one page at a time WITHOUT hitting the last page
button. The numbers correctly stop at 3 and the labels displayed are fine.
So what's the problem with the last page button and this code?
5. I was VERY afraid to actually hit the print button for fear of an endless
stream of pages coming out! But, to complete the test I bit the bullet and
hit print. It correctly printed only 3 pages even though my screen said 99
pages at that moment! Whew!
6. One last note before everyone goes "I'm not seeing this." This
"weirdness" only happens on Access 97 and 2000. I do NOT see this behavior
on Access 2002 or 2003. I have done a LOT of testing on various operating
systems and page numbers, but it only occurs on 97 and 2000. For the last
two versions no matter how big the report was (and I tried really big)
clicking the last page button correctly took me to the last page after a few
seconds. And yes, I believe each system had the latest service packs and Jet
updates.
So my questions:
1. Can anyone else see this on 97 or 2000?
2. Why does this problem happen on 97 and 2000?
3. Anyway around this? The users want to know how many pages are going to
print, but they're afraid to hit the print button!
Thanks for any comments and/or thoughts.
Jeff Conrad
Bend, Oregon