Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2011
    Posts
    19

    Unanswered: How can I set the "Left" Property in VBA?

    Hello,
    I'm not sure if this is entirely feasible, I've done some research online and I can't seem to find the solution to this issue.

    I have several fields on this form, when the user selects an option from the option form, it will turn on and off specific fields depending on the type of request they are submitting.

    Instead of having multiple fields clouding up my form in design view, I've altered the code so that the labels change names depending on what option is selected.

    Example:
    If Option 1 is selected the text box labled "First Name" will show.
    When Option 2 is selected that same text box's label will change to "Apartment Number"

    This isn't an exact representation of the type of data I use, but just an example.

    So for my text boxes and their locations, when option 3 is selected, the text box "Orignial Copay" becomes visible, and the "Left" location is '6.5104"'

    However, when Option 4 is selected the label for that text box is quite a bit longer, and I want the code to shift the text box itself over to '7.2813"'

    Are there any properties that exist where I can have the "Left Property" altered in the code? Or should I just deal with the visual design that the text boxes will be really far away from their labels when option 3 is selected versus option 4?

    It's not super urgent or anything like that but I'm curious to know if this is something that I can alter in the code so I don't have to create a bunch of different text boxes. I like simplicity on my forms and in my design modes so it's easier to read the forms.

    The code I'm primarily used to working with is HTML and CSS where I'm used to being able to set whatever kind of properties and locations for objects within the page. I just didn't know if the same could be done in VBA.

    Thanks!
    - Ari

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You can use:
    Code:
    Me.Label1.Left = 1440 ' In twips (= 1")
    Me.Label1.Width = 1440 ' In twips (= 1")
    Have a nice day!

  3. #3
    Join Date
    Sep 2011
    Posts
    19
    Beautiful!

    Thank you!

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

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