Search for list box values using test box.

G

gao_jenny

Hi,
I have a "cbmIDN" combo box bind to "tblIDN", which has
values (0,1,2,3,4,5, All IDN)for each IND#. I have a
list box(IPAselect)bound to "tblIPA" whick has
(IPA,IPAName,IDN), in the list box, the IDN was hidden,
it's just got refreshed/requried according to the IDN
that you chose in the cbmIDN. Now because the list box
with a long list for IPAs, I added in a text box for
search IPA purposes named "txtIncSrch", once I type in an
IPA number in the search box, the "IPASelect" will
point/show the correct or at least closet match for IPAs
that I entered in the search test box, I've used the
following codes in the search box"ON Change" event, so
far it only worked on the IPA list when the IDN number
is either 0 or All IDN. MY IPA numbers are like
("00","B4","B5","P0","D7", "M3","UB", etc.). Please take
a look at my codes, give me any suggestions. Thanks.
*********
Private Sub txtIncSrch_Change()
Const adhcQuote = """"
Dim varvalue As String
Dim strField As String
varvalue = txtIncSrch.Text
Dim strCriterid As String
Dim mdb As DAO.Database
Dim mrst As DAO.Recordset

Set mdb = CurrentDb
Set mrst = mdb.OpenRecordset("TmpDiabIDNIPASelect",
dbOpenDynaset)
'strField = mrst!IPA
strCriterid = "IPA >= " & adhcQuote & varvalue &
adhcQuote
mrst.FindFirst strCriterid
If Not mrst.NoMatch Then
lstIPASelect = mrst!IPA
Else
MsgBox "Please type in a valid IPA
number:"

End If
mrst.Close
Set mrst = Nothing
End Sub
**********
Jenny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top