![]() |
MS Access FAQ - Performance |
![]() |
![]() |
Making combo boxes faster #1 |
![]() |
Making combo boxes faster #2 |
![]() |
How can I make my combo and list boxes faster? #1 | ![]() |
![]() |
- Include only fields from the record source that are absolutely necessary. Extra fields can decrease combo or list box performance. - Index the first field that is displayed in the combo or list box. - Index any other fields used for criteria (such as when a combo or list box is based on a criteria query). - In combo boxes, set the AutoExpand property to No if it is not needed. - Create a default value for combo boxes. Combo boxes try to match whatever is entered in them, so if there is no default value for the combo box, the combo box tries to match a null value when it is first opened. An example of a default value for a combo box is: =[combobox].ItemData(0) In the example above, [combobox] is the name of the combo box. - Use unbound subforms to display data when there is a large number of records. Updated: 08/11/1996 - Jim Hance | ![]() |
![]() |
How can I make my combo and list boxes faster? #2 | ![]() |
![]() |
Combo boxes in Access are very inefficient when large amounts of records are dealt with, the single best thing you can do is to restrict the number of records that are returned in the query. What I generally do is to place a text box on top of the combo box so that only the drop down button is visible. The idea is that in most cases, the user drops the box and starts typing away to get down the records he/she wants, my way just reverses the order of things, the user types the first part of what they want then drops the list. The OnEnter event will change the RowSource of the combo box to return a few records depending on what the user typed in, e.g. Sub cbo_Enter() cbo.RowSource="select id, desc from tbl where desc like '" & txtTextBox & "'" End Sub I generally have a similar procedure tagged onto the NotInList event of the combo box just in case the user finds nothing and starts typing in something that isn't there (as they do). Updated: 08/11/1996 - Trevor Best | ![]() |