hi.. i am a newbie programmer taking up computer science and a freshmen...and i don't know on how to make an autocomplete codes in a combo box..in where u can easily type down the letters or words, and the combo box will automatically find that letters or word even if is wrong spelled.........someone help me..on my project.......Pllllllzzzzzzzzzzz.....^_^

Recommended Answers

All 4 Replies

try to use LIKE search and fill the combobox with the recordset.

eloww...can you be more specific..
actually we are so very new in vb.
it a big thing to help us in a very clear answer..
thxxxxxxxxx

for alwayzzzzzzzzz replying........

jaasaria

1.Type a word in the cobobox.
2.Pass the value to open the recordset.
3.Populate teh combo with items from recordset.

Use the change event of combo box for the purpose.

try this out.

private sub combo1_change()
dim db as database
dim rs as recordset

set db=opendatabase(app.path & "\student.mdb")
set rs=db.openrecordset("select name from info where name like '%" & trim(combo1.text) & '", dbopendynaset)
combo1.clear
if rs.recordcount>0 then
     rs.movefirst
     while not rs.eof()
         combo1.additem rs!name
         rs.movenext 
     wend
else
     combo1.text="no record found."
endif
combo1.listindex=0  
combo1.selstart=0
combo1.sellength=len(combo1.text)
combo1.setfocus
end sub

here "student.mdb","info" and "name" are the access database,table & field names respectively. replace these with your own data.

regards
Shouvik

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.