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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Labels

Status
Not open for further replies.

twarner

IS-IT--Management
Aug 3, 2005
7
US
Hi,
I am trying to create a report to generate labels. The data sourse is from a query. What I want the report to do is group on one field say (Birds)and then in the detail section list the grouping (Robin, Blue Jay Etc.). The problem is that each label can have a different number of items in the detail section which throws of the size of the label. Any help with this would be much appreciated I am pulling my hair out. :)

Thanks in advance!
 
The detail textbox is probably set to canGrow and maybe can shrink which allows access to change it size. In the onFormat event for the detail you may wish to explore setting font size based on amount of text.
 
Hi,
The problem I have with setting the detail setion to anyting other than the exact size of the test boxes you get spaces in between the items. I am tring to adjust the size by hte footers.
 
You could make sure that each label has the same number of items. You could do this in the table structure or "pad" in the query. Then when you create your report, in the OnFormat event, test for null for each field. If it is null, then set that textbox to invisible. This way each label is the same size. If I think I understand your question.
 
Hey,
I put together a basic sample of what you are going to need to use. The values and variable names are up to you. But it will set the group footer height to fill in the label.

Basically, the code resets the cnt each time the group header is shown. Then when it gets to the group footer it set the height based upon the height of the header plus the height of detail * the number of details. Then the lablehght( determined by you) is used to find the difference.

You can add code to print over two labels if the details are to tall to fit. But it is a good start. Good Luck and let us know if you need more?

Code:
Option Compare Database
Dim cnt As Integer
Const labelhght = 3000
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
    cnt = 0
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    cnt = cnt + FormatCount
End Sub

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
    hght = labelhght - (cnt * (Detail.Height + GroupHeader0.Height))
    GroupFooter1.Height = labelhght - hght
End Sub
 
Thank you!!! This looks like it will work great. Unfourtunatly
I am on a fun Exchange server install and wont get to try it to later in the week. :( Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top