
***** Question: Finding a record based on the selection from a Combo Box or List
What you are looking to do is not only very possible but fairly easy.
You need to become familiar with SQL. You don't mention, but I'm assuming you are
populating the list with .additem? There are other ways to populate the list.
Basically you want to lay down a data control that is connected to the database
you are polling. On a click event you want to do something like:
dim rs as recordset
rs = "SELECT * FROM [ENTER TABLE NAME HERE] WHERE [ENTER FIELD NAME HERE] = '" &
combo1.text & "'"
data1.recordset = rs
data1.refresh
data1.updatecontrols
This is just what I remember off the top of my head. It may not be exact. If you
need exact lines of code, email me and I can show you exactly how it's done.
Essentially what you need to do is run a SQL query based on a combo box selection.
This is very easily done.
Hope this helps,
Phil
Quote:
> I'm rather new at using VB 4.0, and i'm having a problem getting a
> selection from a combo box or list to query my database for that particular
> record. i'm looking for the same functionality as in MS Access when setting
> up a combo box on form to query a record based on the selection. i don't
> know if this is even possible in VB. any help or guidance will be
> appreciated.
> thanks,
> Mike...