Results 1 to 4 of 4
  1. #1
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    111

    Column width in subform needs to match label's width


    I have a subform that is displayed as a datasheet (I do not want it continuous). One field is a check box but the label (column header) is about 20 characters long and is truncated in the datasheet view. How can I programmatically adjust this column width when opened so that the width matches the label's width?

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Code:
    Private Sub Form_Load()
      Me.ActualTextboxName = -2
    End Sub
    Replacing ActualTextboxName with your actual name.

    You might be interested in this article 'You Can Do That With Datasheets?'

    http://msdn.microsoft.com/en-us/libr...ice.11%29.aspx

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Think you missed a bit linq!

    Me.ActualTextboxName.columnwidth = -2

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Oops! Had a ridiculously long Control name for testing (hadn't done this in a while) and when replacing it with a better name, for posting, left that off!

    Code:
    Private Sub Form_Load()
      Me.ActualTextboxName.ColumnWidth = -2
    End Sub

    Thanks for the assist, Ajax!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. adjust column width in datasheet form
    By Bospeentje in forum Forms
    Replies: 3
    Last Post: 09-15-2014, 10:13 AM
  2. Section Width is greater than page width
    By snowboarder234 in forum Reports
    Replies: 3
    Last Post: 07-31-2013, 09:06 PM
  3. Replies: 2
    Last Post: 02-22-2012, 05:10 PM
  4. The section width is greater than the page width?
    By Gary_Marshall in forum Reports
    Replies: 2
    Last Post: 11-13-2009, 01:54 PM
  5. Replies: 0
    Last Post: 12-25-2008, 10:05 AM

Tags for this Thread

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