Prevent users typing in text in a combo box, Access 97 (1 Viewer)

eyewonder

New member
Local time
Today, 12:10
Joined
Dec 15, 2011
Messages
9
While designing a form & putting various controls on it, and switching to 'code view', the top of the window has 2 combo boxes - left one for the labels, command buttons, etc that I have placed on the form. The right combo box allows me to look at the properties of the selected object. While designing my form and wanting to deal with one of the objects, I can type a single letter in the left combo box (such as c) and the 1st 'c' object, likely a command button, is hi-lited. I can not type any more letters in the combo box to select a different object. Thus I am prevented from having anything in the text box that is not already loaded into it.

On my form I have combo box with a row source of 'qry_employees'. I would like to have my combo box exhibit the same behavior as the combo box in the code view window. At the moment, I can type the first letter of the employee's name, & it pops up, as desired, but I can continue entering text in the combo box, which causes other problems

Is there a way to prevent users from typing anything into the combo box, forcing them to scroll & click the selected name? I have played with all the properties for the combo box, but no luck.

Cheers
Steve
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:10
Joined
Oct 29, 2018
Messages
21,469
Hi. Not sure you can do that with just a Combobox. You might be able to simulate it with a Textbox and a Combobox together.
 

bastanu

AWF VIP
Local time
Today, 10:10
Joined
Apr 13, 2010
Messages
1,402
Set the AutoExpand property to No.

Cheers,
Vlad
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 18:10
Joined
Sep 12, 2006
Messages
15,653
it's a good feature though. I wouldn't prevent it. Train the users, and make sure the cboBox is set to "limit to list"
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 13:10
Joined
May 21, 2018
Messages
8,527
See if this fake gives the desired results. Kind of what @theDBguy suggested.
Code:
Private Sub Form_Load()
  HideList
End Sub

Private Sub lstProduct_AfterUpdate()
  Me.txtProduct = Me.lstProduct
  HideList
End Sub

Private Sub lstProduct_Exit(Cancel As Integer)
  HideList
End Sub
Public Sub HideList()
  Me.lstProduct.Height = 0
End Sub

Public Sub ShowList()
  Const theInches = 3
  Me.lstProduct.Height = 1440 * theInches
End Sub

Private Sub txtProduct_KeyDown(KeyCode As Integer, Shift As Integer)
  ShowList
End Sub

Private Sub txtProduct_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  ShowList
End Sub
 

Attachments

  • Force Select.accdb
    968 KB · Views: 201

eyewonder

New member
Local time
Today, 12:10
Joined
Dec 15, 2011
Messages
9
I will try some of the suggestions, but I'm expecting to get hit with rolling blackouts shortly (SE Kansas, USA - burrr -4 F
 

Users who are viewing this thread

Top Bottom