Results 1 to 4 of 4
  1. #1
    NISMOJim is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    273

    Size a textbox

    Here's something I've never tried before, but it isn't working...I would like to lengthen the textbox depending on what is in it. Here is the code I'm trying on the On Current property of the form



    If Me.CourseD = "Too long to fit" Then
    ElseIf Me.CourseD = "Too many letters" Then
    ElseIf Me.CourseD = "Just won't fit here" Then
    Me.CourseD.Width = 2.6354
    Else
    Me.CourseD.Width = 2.1875
    End If

    I've also tried
    If Me.CourseD = "Too long to fit" Or
    Me.CourseD = "Too many letters" Or
    Me.CourseD = "Just won't fit here" Then
    Me.CourseD.Width = 2.6354
    Else
    Me.CourseD.Width = 2.1875
    End If
    How can I get this to work?

    Thanks for any help

  2. #2
    Rod is offline Expert
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    The first thought I have is that VBA works in a measure called, 'Twips.' There are 1440 twips to the inch so you are trying to set your width to something arount 1/500 th of an inch!

    What on earth are all those string literals?

  3. #3
    NISMOJim is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    273
    Definitely not the answer I was expecting about the twips, but it is the one I needed and it is working great now. I was going for inches like is shown in the properties.
    As for the strings, they are just an example I came up with when I posted. It was late & I was tired.
    Thanks again for your help. I wouldn't have gotten it on my own.

  4. #4
    Rod is offline Expert
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Glad to help. The Access user interface uses the measurement setting you set via the control panel. VBA uses twips and only twips.

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

Similar Threads

  1. Any way to set box size?
    By kman42 in forum Reports
    Replies: 2
    Last Post: 04-17-2011, 04:19 PM
  2. OLE field size?
    By Wiele in forum Programming
    Replies: 2
    Last Post: 01-19-2011, 01:22 AM
  3. DB Size
    By kb1 in forum Import/Export Data
    Replies: 2
    Last Post: 08-26-2010, 10:17 AM
  4. Screen Size
    By maintt in forum Access
    Replies: 4
    Last Post: 08-02-2010, 01:12 PM
  5. Field size
    By nikki in forum Database Design
    Replies: 1
    Last Post: 02-15-2010, 09:19 AM

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