Populate combo box based on text entered (1 Viewer)

Filledvoid

New member
Local time
Today, 05:30
Joined
Apr 14, 2016
Messages
3
[Solved]Populate combo box based on text entered

Hello all,
I have a question about a Access 2010 database that I was working on to help a friend.



This form is the form Im working on . What I would like to do is type in the combo box above and then show only data within the combo box which matches the letters typed in . I have tried changing the control source of the combo box to include the criteria Like "*" & [combo box name] &"*" . Then add the following code in the Change event of the combo box.

me.cmb_customer.requery
me.cmb_customer.dropdown

Unfortunately Ive been running into the error that says
Error '2118' You Must Save The Current Field Before You Run The 'Requery' Action .


The combo box above is also used to move to the record selected so that it can be edited.



Would appreciate if anyone could tell me what Im doing horribly wrong here :) .


Thanks in advance.

Edit
Actually sort of found a temporary work-around or solution for what I needed. Changed the combo box row source in the change event.

Combo45.RowSource = "SELECT tblCustomer.CID, tblCustomer.CFullName FROM tblCustomer WHERE tblcustomer.cfullname like '" & "*" & Combo45.Text & "*" & "' "
Combo45.Dropdown
I know this isnt exactly an elegant solution but it sort of does what I need from what I've seen so far. Also noted that setting Autoexpand to Yes might cause a bit of a problem if the characters typed in matches the first letters of a certain entry in the combo box . So Ive turned that off for now.

Cheers .
 
Last edited:

Users who are viewing this thread

Top Bottom