Like I said, I would not use the continuous form as a data entry form. I
would use it to view records, but not to add or edit an individual record.
However, you could copy your continuous form and change it to a single
record form and use that for data entry. Generally, when I have a really
long list of stuff that I want to display in a combo box, but know that it
is too long, or may eventually be too long, is create a textbox (I'll call
it txt_combo) that I place right above (at least in design view) the combo
box (I'll call this cbo_Products). Keep in mind that the code provided
below is untested air code.
1. When the form opens, I change the Top property of the textbox so that it
lays right over the combo box.
1. I set the combo boxes visible property to False
2. I set the TabStop property of the Combo to No, so that you cannot tab
into it.
3. I then add some code to the Enter event of txt_Combo that highlights all
the text in the textbox. I do this so that if I start typing, all the text
that is currently in the textbox will be overwritten.
4. Then, in the Change event of txt_Combo I write a SQL string that selects
the records from the products table that contain the string that is in the
textbox. Something like:
Private sub txt_Combo_Change
Dim strSQL as string
strSQL = "SELECT * FROM tbl_Products WHERE ProductID Like '" &
me.txt_Combo.text & "*'"
me.cbo_Products.RowSource = strSQL
me.cbo_Products = me.txt_Combo.text
me.cbo_Products.visible = True
me.cbo_Products.SetFocus
me.cbo_Products.dropdown
me.txt_Combo.visible = false
End sub
This effectively takes the first character of input to the textbox,
populates the combo, makes it visible, then hides the textbox. Since it
isn't likely that you will have 10000 products that start with the same
number or letter, this will shrink the list for the combo and still allow
you to have the Autocomplete functionality of a combo box.
5. If you use this technique, you will need to use the Change event of the
combo box to make sure that the first letter of the combo matches that of
the textbox. If not, set the value of the textbox to that of the first
character of the combo and reexecute the textboxes change event. Something
like:
Private Sub cbo_Products_Change
if len(me.cbo_Products.text & "") = 0 Then
me.txt_Combo.visible = true
me.cbo_Products.visible = false
me.txt_Combo.setfocus
Elseif left(me.cbo_Products.text) <> left(me.txt_Combo.value) then
me.txt_Combo.value = left(me.cbo_Products.text)
Call txt_Combo_Change
endif
End Sub
Another way to accomplish this is to have a couple of command buttons above
the combo box (A-E, F-J, K-O, P-T, U-Z), or something like this, that the
user clicks to change the WHERE clause on the SQL string for the combo to
display only the products that start with these values.
HTH
Dale