Hi,

Some background:
----------------

I relatively new to access, and found and interesting article on this website, describing how to limit rows shown in a combo box.

http://techrepublic.com.com/5100-6329-5031812-2 .html#Listing%20B


Problem:
----------

Hi,

Per your suggestion, put most of cbox info, in the properties box on the design-form,
and I adjusted code (see way below):

It improved a little....when I type the first letter "b", the "b" is now in the combo-text box, but
cobo box passed the full-length value of the first "b" item , in this case "bALL" in the
Me!cboByName.Text, and autoExpand is set to No. The following is the sql that was generated:

Select ssn ,[Last name] ,[First Name] FROM z_STAFF WHERE [Last Name] LIKE "bALL*" ORDER BY [last name], [first name]

any advice? (Also, I have more serious problem on a different topic, and was wondering if I opened another question, could you take a look at it.....thx...).

Test data, which should show when user keys in "b":
==================================
BALL LUCILLE
BEAME ABRAHAM
BLOOMBERG MICHAEL
BRODERICK MATHEW
BROWNING ROBERT
BULLOCK SANDRA

================================================== ==
Today, I looked up the autoexpand property in access vba, it said that if combo box is set to notinlist=yes, and dropdown, autoexpand will be reset to yes....which i see happening....so how did the above website article get the logic to work.....Any advice would be welcome....thank you!


================================================== ====
Private Sub cboByName_Change()

Dim strBackSql As String
Dim strFind As String

strFind = Me!cboByName.Text


strBackSql = "Select ssn" & _
" ,[Last name] " & _
" ,[First Name]" & _
" FROM " & pg_strTableName_Staff & _
" WHERE [Last Name] LIKE " & _
pgc_strQuote & _
strFind & pgc_strAsterisk & _
pgc_strQuote & _
" ORDER BY [last name], [first name]"

Debug.Print strBackSql




With Me.cboByName

.RowSource = strBackSql
' .Requery
.Dropdown

End With



End Sub