Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Twice problem

Status
Not open for further replies.

Zonie32

Technical User
Jan 13, 2004
242
US
I am using WinXP and Access 2003. I created a report with multiple columns, down and across. I want 6 columns to a page. I wanted a specific "carrier" to always show up as the first column and all other "carriers" in any order after that is fine. Here is the code I used, but for some reason it is formatting all columns twice, except the first column. This is making column 2 overlap most of column 1. So not all of column 1 shows up, just the first few letters of each field, then column 2 goes on top of it. Can anyone help me figure out why this is happening? Let me know if you need more info about the report.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim intColumnCount As Integer

intColumnCount = 6

If txtCounter Mod intColumnCount = 1 Then

With Me.Printer
.ItemsAcross = intColumnCount
.RowSpacing = 0
.ColumnSpacing = 0
.DefaultSize = False
.ItemSizeWidth = 3168
End With


Label00001.Visible = True
Label00002.Visible = True
Label00003.Visible = True
Label00004.Visible = True
Label00005.Visible = True
Label00006.Visible = True
Label00007.Visible = True
Label00008.Visible = True
Label00009.Visible = True
Label00010.Visible = True
Label00011.Visible = True
Label00012.Visible = True
Label00013.Visible = True
Label00014.Visible = True
Label00015.Visible = True
Label00016.Visible = True
Label00017.Visible = True

Carrier.Left = 1440 + 1440
Benefit_Summary_Label.Left = 1440
blue_Box.Left = 1440
Premium.Left = 1440
Differential.Left = 1440
InNetwkDed.Left = 1500
OutOfNtwkDed.Left = 1500
Coinsurance.Left = 1500
OOPInNtwk.Left = 1500
OOPNonNtwk.Left = 1500
PhysCopay.Left = 1500
ERCopay.Left = 1500
InptConfinement.Left = 1500
OutptSurgery.Left = 1500
Wellness.Left = 1500
Rx.Left = 1500
LifeIns.Left = 1500
LifetimeMax.Left = 1500
Maternity.Left = 1500

Else

With Me.Printer
.ItemsAcross = intColumnCount
.RowSpacing = 0
.ColumnSpacing = 0
.DefaultSize = False
.ItemSizeWidth = 1800
End With

Label00001.Visible = False
Label00002.Visible = False
Label00003.Visible = False
Label00004.Visible = False
Label00005.Visible = False
Label00006.Visible = False
Label00007.Visible = False
Label00008.Visible = False
Label00009.Visible = False
Label00010.Visible = False
Label00011.Visible = False
Label00012.Visible = False
Label00013.Visible = False
Label00014.Visible = False
Label00015.Visible = False
Label00016.Visible = False
Label00017.Visible = False

Carrier.Left = 1440 - 1350
Benefit_Summary_Label.Left = 1440 - 1350
blue_Box.Left = 1440 - 1350
Premium.Left = 1440 - 1350
Differential.Left = 1440 - 1350
InNetwkDed.Left = 1500 - 1350
OutOfNtwkDed.Left = 1500 - 1350
Coinsurance.Left = 1500 - 1350
OOPInNtwk.Left = 1500 - 1350
OOPNonNtwk.Left = 1500 - 1350
PhysCopay.Left = 1500 - 1350
ERCopay.Left = 1500 - 1350
InptConfinement.Left = 1500 - 1350
OutptSurgery.Left = 1500 - 1350
Wellness.Left = 1500 - 1350
Rx.Left = 1500 - 1350
LifeIns.Left = 1500 - 1350
LifetimeMax.Left = 1500 - 1350
Maternity.Left = 1500 - 1350

End If
End Sub
 
Hi

On format may be executed more than once, that is what FormatCount As Integer parameter is telling you

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
How do I know if it is executed more than once? How would I go about fixing this? Do I need to do something with the code or do I have to turn something off in properties?
 
I would look it up in the Access help. My guess is that either the variable FormatCount holds the value of what iteration of formatting the report is currently on, or you can pass a value telling it how many times to format.

I don't have access to... Access right now or I would look it up and tell you. If I find out which it is I will post back with the info.
 
I had a similar problem in the past. What I found was causing the problem was using the [Pages] field on the report. This caused the format to execute twice(first time to determine the number of pages) and screwed up my report. After I took the [Pages] field off the report everything looke3d fine. Don't understand why but....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top