Combo box (1 Viewer)

amavadia

Registered User.
Local time
Today, 06:31
Joined
Mar 30, 2006
Messages
36
I have a combo box on a form that allowes the user to select a record to be displayed in the form. The problem is i have about 3000 records in the table. Is there any way you can create a drop down menu with all the letters of the alphabet, and then use that to filter the records available in the drop down menu?
 

amavadia

Registered User.
Local time
Today, 06:31
Joined
Mar 30, 2006
Messages
36
I have a combo box on a form that allowes the user to select a record to be displayed in the form. The problem is i have about 3000 records in the table. Is there any way you can create a drop down menu with all the letters of the alphabet, and then use that to filter the records available in the drop down menu?
 

KenHigg

Registered User
Local time
Today, 01:31
Joined
Jun 9, 2004
Messages
13,327
amavadia said:
I have a combo box on a form that allowes the user to select a record to be displayed in the form. The problem is i have about 3000 records in the table. Is there any way you can create a drop down menu with all the letters of the alphabet, and then use that to filter the records available in the drop down menu?

You may be able to do this with what's referred to as cascading combo boxes. Do a search on the forum and you should should find plenty of posts on the topic...
 

Bobadopolis

No I can't fix it dammit!
Local time
Today, 06:31
Joined
Oct 6, 2005
Messages
77
Set the rowsource of the combo box to be a "value list" with one column. The rowsource will be:

cboLetters:
Code:
a;b;c;d;e;f;g;h(...);z

The Second combo would have a rowsource something like:

cboSearch:
Code:
SELECT YourTable.YourField FROM YourTable WHERE YourField like [Forms]![MyForm]![cboLetters] & "*") FROM YourTable ORDER BY YourTable.YourField;

In the query that the form runs from you want a criteria in the field that you're filtering by:

Code:
Like [Forms]![MyForm]![cboSearch] & "*"

In the AfterUpdate event of cboLetters you need to requery the second combo:

Code:
Me.cboSearch.Requery

In the AfterUpdate event of the cboSearch you need to requery the Form:

Code:
Me.Requery

That should do the trick :)

Bobadopolis
 
Last edited:

Sergeant

Someone's gotta do it
Local time
Today, 01:31
Joined
Jan 4, 2003
Messages
638
There are many ways to improve this situation.
One thing I have done is NOT populate the combo box until the third letter is typed by the user.
Do this by making a 'Change' event behind your combo box. In the event, do something like:
If Len(Me.MyComboBox.Text) > 2 Then
Me.MyComboBox.RowSource = "SELECT........WHERE MyText Like '" & Me.MyComboBox.Text & "*'"
Me.MyComboBox.DropDown
End If
 

Users who are viewing this thread

Top Bottom