Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2014
    Posts
    12

    Unanswered: Combo box and GotFocus

    I have the correct VBA code to have the Got Focus and Lost Focus to work. However, I want my combo box to (on Got Focus) to expand over the top of the rest of the form. Right now my code is making all of the other fields shift to the right. How can I make the On Got Focus code expand the combo box in front of everything else on the form?

    Any help is greatly appreciated.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Quote Originally Posted by natejlefebvre View Post
    I have the correct VBA code to have the Got Focus and Lost Focus to work.
    To work for doing what?

    Guidelines:
    - When a question involves VBA code, please post that code.
    - When a question involves queries, please post the SQL expression of those queries.
    - When a question involves tables and relationships, please post the definition of the tables (name + column names + data type of each column).
    Have a nice day!

  3. #3
    Join Date
    Apr 2014
    Posts
    12
    Private Sub cboProductDescription_GotFocus()
    cboProductDescription.Height = 900
    cboProductDescription.Width = 8000
    End Sub

    I tried setting the position to "Bring to Front", but the combo box is still expanding and pushing the rest of the form to the right.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Quote Originally Posted by natejlefebvre View Post
    I tried setting the position to "Bring to Front", but the combo box is still expanding and pushing the rest of the form to the right.
    ??? If a combobox control is located on a form, I don't see how it could move that form (its parent), simply when expanding the list part. Something is missing here.
    Have a nice day!

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    when combo boxes get the focus they auto expand to show a few rows. the whole ideaz behind a combo box is that the user can start typing the value they are expecting/looking for.

    if you don't want other cotnrols to be relaid then dont' change the basic size of the combo.
    or if you must persist in rewriting basic behaviours of standard UI controls I'd suggest you open a modal form with a combo box as big as you feel neccesary
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Apr 2014
    Posts
    12
    Thank you for the feedback. The problem I have is the Descriptions are longer than the size of the current combo. I was hoping to find a solution to be able to see the enter description when using the drop-down within the combo.

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so widen the combo box at design time to fit the data. don't do it on the fly
    I'd rather be riding on the Tiger 800 or the Norton

  8. #8
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Moreover, if you want to change the height of the list, use the ListRows property of the combo, while changing the ListWidth property will chnge the width of the list past of the combo without affecting the dimensions of the textbox part of the control.
    Have a nice day!

  9. #9
    Join Date
    Apr 2014
    Posts
    12
    Thank you for the information! I have changed the ListWidth and it is doing EXACTLY what I want it to do. This was a much simpler solution than what I was finding prior to posting on the forum!

    You guys rock!

  10. #10
    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
  •