Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2007
    Posts
    29

    Unanswered: Multiple formats across same report

    All I am trying to make a report that will produce labels for me. The problem is I need to use different placement based on attributes of each record. I have around 15 different configurations that are possible. Ideally I would like to build a strings in VBA and put them in a text boxes for each configuration. I simply cannot figure out where to start. I would like to set this up where all anyone needs to do is open the report and press print.

    Thank You

    -Jerry

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    The user's experience does not necessarily need to reflect the underlying objects that the user is hitting. If you have radically different labels that are required based on arbitrary criteria, I would create a number of separate reports and decide which one is to be opened when the user decides they want to open your label report.

    If you are talking about subtle differences, you could manually evaluate your "attribute" field in the on_format event of the detail section for your report.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jul 2007
    Posts
    29
    I have a boat load of different reports right now. Some are very subtle, shown number of decimal points based on attribute for example. None are so complex or radically different that they should require a separate report if I could turn a few things on and off.

    My big problem is that I cannot figure out how evaluate any of the attributes inside a report.

    Do I need to build a form then have the form call a report? Seems like overkill for what I want to do.

    As above my example is I have a field for thread count. If the metric attribute is false I need 2 Digits no decimal places. On true I need 1 digit with 3 decimal places.
    Last edited by sattlerjm; 07-17-07 at 16:35.

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    To format your labels you will want to use the On Format event of the Detail section. This is where your label should go. How many labels to a page? Are the labels at least the same dimensions?

    It's hard to say what the best way to pass the attributes. But my opinion is that because it is dependant on the record I would try to include those attributes in the query that feeds the report. Then in the On Format event evaluate the key attributes and modify your report accordingly.

    An approach I have used in the past is to use the Tag property of the controls on the report. For example if there are 9 formats I would put a 1 in each Tag property for each control that needs to appear for format 1. Then loop through the controls and check to see if a 1 is in the tag field or not. The control can be used for more than one format by putting 23478 in the Tag field and formats 2, 3, 4, 7 and 8 would all show that particular control.

    Here is some code to demonstrate:

    Code:
    Public Sub SetLetterType(intLetterType As Integer)
    
        Dim strOpenArgs As String
        Dim varControl As Variant
        
        intLetterType = IIf(intLetterType = 0, 2, intLetterType)
            
        'Now that the letter type has been decided, activate any hidden controls
        If intLetterType <> 1 Then
        
            For Each varControl In Me.Controls
        
                If varControl.ControlType = acTextBox Or varControl.ControlType = acLabel Then
                
                    If InStr(1, varControl.Tag, CStr(intLetterType)) Then
                    
                        varControl.Visible = True
                    
                    End If
                
                End If
                
            Next varControl
            
        End If
        
        
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •