Results 1 to 7 of 7
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862

    Form formatting

    I am trying to get the origin report to format like thewanted bold boxes. I have hideduplicates in the form on the Services and Component fields. What I would like to do is have the fieldexpand to encompass the whole area that the Services field is and the Servicebe in the middle of the field from top to bottom and side to side. I would like to do the Component field do thesame as the Services field.

    Services, Component, Date, Pass, Fail are Can Grow/Can Shrink

    Click image for larger version. 

Name:	Orig2.PNG 
Views:	24 
Size:	27.1 KB 
ID:	38320



    Click image for larger version. 

Name:	Out2.png 
Views:	23 
Size:	32.4 KB 
ID:	38321

    Click image for larger version. 

Name:	Formview.PNG 
Views:	23 
Size:	27.3 KB 
ID:	38322


  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Access reports are not spreadsheets. Can't do what you want.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    I'll disagree a little with June here, and say you can do it, but it's not very easy. (This is in a report , certainly not possible in a form)

    You can get the height of the expanded text box and then set the other text box height to match that, I have done it on a statement of works where both the fault and scope of works could be a single line or multiple lines;
    I was only adjusting the label box size and position but it works. Code is below as a starting point, but I warn you it takes quite a lot of fiddling around with to make it work.

    Excuse all the commented out bits. They were from me debugging and getting it to work.

    You may need to concatenate your third level items into a list to get the sectioning to work.

    Code:
    Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
    
    
     
        Dim X1    As Single, Y1 As Single
        Dim X2    As Single, Y2 As Single
        Dim Offset As Single
        Dim BoxColor As Long
        Dim FillColour As Long
        Dim lblTop As Integer
        
        
        ' Specify unit of measurement for coordinates on a page...
        Me.ScaleMode = 1                             ' ...in twips (1440 twips = 1 inch).
    
    
        ' Define an offset of 1/8 inch from the text box to the rectangle.
        Offset = 12
      
        
        lblTop = Me!txtQuoteText.Top
        Me.lblQuoteText.Top = lblTop
        
        ' Width of the line (in pixels).
        '1 pt = 12
        '2 pt = 24
        '3 pt = 36
        '4 pt = 48
       
    
    
    End Sub
    
    
    Private Sub GroupHeader1_Print(Cancel As Integer, PrintCount As Integer)
        
        
        Dim X1    As Single, Y1 As Single
        Dim X2    As Single, Y2 As Single
        Dim Offset As Single
        Dim BoxColor As Long
        Dim FillColour As Long
        Dim lblTop As Integer
        
        
        ' Specify unit of measurement for coordinates on a page...
        Me.ScaleMode = 1                             ' ...in twips (1440 twips = 1 inch).
    
    
        ' Define an offset of 1/8 inch from the text box to the rectangle.
        Offset = 12
    
    
        ' X and Y coordinates for the top left corner of the box.
        X1 = Me![lblRepFault].Left - Offset
        Y1 = Me![lblRepFault].Top - Offset - 12
    
    
        ' X and Y coordinates for the bottom right corner of the box.
        X2 = X1 + Me![lblLabour].Width + Offset      '+ Me![txtLabourValue].Width + Offset
        Y2 = Me![lblLabour].Top                      '+ Me![txtQuoteText].Height + Offset
        
        
        ' Width of the line (in pixels).
        '1 pt = 12
        '2 pt = 24
        '3 pt = 36
        '4 pt = 48
        BoxColor = RGB(166, 166, 166)                'RGB(255, 0, 0) '              ' Use Dark grey  color.
        FillColour = RGB(217, 217, 217)              'RGB(217, 217, 217)
        ' Draw the rectangle with the Line method.
        Me.DrawWidth = 1
        Me.Line (X1 - 6, Y1 - 6)-(X2 - 1, Y2 - 6), FillColour, BF
        
        Me.DrawWidth = 12
        Me.Line (X1, Y1)-(X2, Y2), BoxColor, B
        
       
        'Me.Line Step(Me.txtHoursText.Top, Me.txtHoursText.Left)-Step(0.021, 0), vbRed, BF
    
    
    End Sub
    The two box sections circled (very badly in blue!) can grow and shrink as required, to match the sections on the right.

    Click image for larger version. 

Name:	ReportSectionGrows.PNG 
Views:	18 
Size:	91.6 KB 
ID:	38326
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I should have said "not without code" and the 3rd level items will have to be concatenated, not maybe, and that means more code http://allenbrowne.com/func-concat.html

    Programmatically controlling height of textbox has been topic of threads before https://www.accessforums.net/showthread.php?t=76743.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862
    When you are referencing third level concatenation, are you refereeing to the Details portion of the report? Or are you referring to "Establish Criteria" column?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The 3rd column shown in your image for field named "Establish Criteria".

    However, I don't see how this code can work for more than 2 columns.

    And note that the data in Minty's column 1 example is not centered vertically.

    I am doubtful you can get exactly what you want.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    the data in Minty's column 1 example is not centered vertically.
    you can centre vertically by using the control top padding property - something like

    mycontrol.toppadding=(mycontrol.height/2)-something for the text height

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Form Formatting Issue
    By Allienne in forum Forms
    Replies: 3
    Last Post: 12-13-2018, 11:17 AM
  2. Replies: 2
    Last Post: 11-12-2015, 10:46 AM
  3. Form Header Formatting
    By SammyH in forum Forms
    Replies: 5
    Last Post: 01-25-2013, 10:14 PM
  4. Form Header Formatting
    By tylerg11 in forum Forms
    Replies: 3
    Last Post: 10-12-2011, 02:05 PM
  5. Conditional formatting on form
    By ngruson in forum Forms
    Replies: 11
    Last Post: 09-17-2010, 12:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums