Results 1 to 8 of 8

Thread: Combo Staydown

  1. #1
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts
    At present I have a listbox with a search textbox. The list fills as a user enters characters. I want to replace the listbox with a combo, but the user cannot see entries as they are filled as the combo closes when focus is put back to the textbox. Is there a way to make the combo dropdown stay down or am I stuck using listboxes? Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You could use a combo box only, without a text box. The user can type in the text box part of the combo box. The dropdown list of the combo box will remain open while the user types.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Hans, stupid me forgot I could do that. Good to see the sun over here (UK) but it's a bit warm, losing track of things. Trust your well, regards

  4. #4
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Any ideas why this does not work? After a user selects an item in a combo, a messagebox asks if what selection they have made is correct. If not I want to return to the combo being dropped down for another selection. However the dropdown does not fire. I tried putting the dropdown command in the got focus event of the combo but it still does not dropdown?

    Private Sub Combo1_Click()
    If MsgBox("You selected " & Me.Combo1.Value & " is this correct?", vbYesNo) = vbYes Then

    Else
    Me.Combo1 = Null
    Me.Combo1.SetFocus
    Me.Combo1.Dropdown

    End If

    End Sub

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    It's sunny and warm here on the other side of the North Sea too...

  6. #6
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Glad your getting the decent weather as well. I think my last question/problem crossed with your reply. I cannot seem to get a combo to dropdown after leaving a messagebox. (earlier thread). Any ideas, thanks. I have tried the code in the afterupdate event, I also tried setting focus to a textbox having a combo dropdown command, but all I get is the combo opening for a split second? Regards

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Sorry, I missed your question indeed.

    I don't think this is user-friendly. I, for one, would refuse to use software that asked me for confirmation each time I selected an item from a combo box.

    If you insist, you could use the Before Update event, set the Cancel argument to True and drop down the list. You can't clear the combo box in the Before Update event, however.

    For example, to really annoy the user:

    Code:
    Private Sub Combo1_BeforeUpdate(Cancel As Integer)
      If MsgBox("You selected " & Me.Combo1.Value & ", is this correct?", _
    	  vbYesNo + vbQuestion + vbDefaultButton2) = vbYes Then
    	If MsgBox("Are you sure?", _
    		vbYesNo + vbQuestion + vbDefaultButton2) = vbYes Then
    	  If MsgBox("Are you really sure?", _
    		  vbYesNo + vbQuestion + vbDefaultButton2) = vbYes Then
    		If MsgBox("Are you really really sure?", _
    			vbYesNo + vbQuestion + vbDefaultButton2) = vbYes Then
    		  Exit Sub
    		End If
    	  End If
    	End If
      End If
      Me.Combo1.Dropdown
      Cancel = True
    End Sub

  8. #8
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Many thanks Hans. Your code is excellent, I like winding up users (only joking). But thanks, having the code moved to the beforeupdate mode worked. Basically the confirmation is part of a flowpath of events where thes user answers yes/no to each move. I could have used yes no command buttons but thought it would be a longer way round. I could have made active forms, but again the messagebox is easier to put in. It will get broken up with fields to fill in, so should not seem repetitive. Regards and thanks for the fix.

Posting Permissions

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