Results 1 to 8 of 8
  1. #1
    Join Date
    May 2010
    Posts
    5

    Unanswered: Control Field Location in VBCode

    Access 2007: I have a form with 4 text boxes going down. If the first box isn't available it is grayed out. I would like to have the location of the box below it take it;s place on the form so there is no blank space.

    I tried on vbcode setting the property for the second property to be the
    same distance from the top (text2.top = "2.029") When I do that, the text box they moves to the top of the screen instead of about a half inch up.

    Any ideas on how to do this?

    Thanx

  2. #2
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by sjsmith View Post
    Access 2007: I have a form with 4 text boxes going down. If the first box isn't available it is grayed out. I would like to have the location of the box below it take it;s place on the form so there is no blank space.

    I tried on vbcode setting the property for the second property to be the
    same distance from the top (text2.top = "2.029") When I do that, the text box they moves to the top of the screen instead of about a half inch up.

    Any ideas on how to do this?

    Thanx
    It would help to see the actual VBA code you are using. Would you please post all the VBA code for the event/sub/function.
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    When using VBA code to move a control, the measurement unit is the Twip, no inches and no centimeters. 1 inch = 1440 twips, 1 centimeter = 567 twips.
    Have a nice day!

  4. #4
    Join Date
    May 2010
    Posts
    5
    lblLetter2.Caption = rsLetterControl("ExpeditedLtr2Name") & ":"
    lblLetter2.Visible = True
    -----> lblLetter2.Top = "2.209" <-----

  5. #5
    Join Date
    May 2010
    Posts
    5
    How do specify twips?

  6. #6
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    See above: 1 inch = 1440 twips, 1 centimeter = 567 twips.
    Have a nice day!

  7. #7
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by sjsmith View Post
    lblLetter2.Caption = rsLetterControl("ExpeditedLtr2Name") & ":"
    lblLetter2.Visible = True
    -----> lblLetter2.Top = "2.209" <-----
    This does not appear to be all the VBA code including the event/sub/function definitional lines.

    Example:
    Code:
    Private Sub Form_Current()
    
           rsLetterControl("ExpeditedLtr2Name") & ":" 
           lblLetter2.Visible = True
           'position  control
           lblLetter2.Top = 2.209 * 1440 ' convert inches to twips
    
    End Sub
    I am not sure what event you are using to fire the VBA code. I just used one as an example.
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  8. #8
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    You could also possibly use:

    rsLetterControl("ExpeditedLtr2Name") & ":"
    lblLetter2.Visible = True
    'position control
    lblLetter2.Top = 2.209 in (note: not ")
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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