***** Question: Finding a record based on the selection from a Combo Box or List 
Author Message
 ***** Question: Finding a record based on the selection from a Combo Box or List

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...



Sun, 21 Nov 1999 03:00:00 GMT  
 ***** 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...




Sun, 21 Nov 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ***** Question: Finding a record based on the selection from a Combo Box or List

2. List Box & Combo Box selection notification

3. select records based on the selection from the dropdown combo

4. Auto Populate List Box Based on Previous Selection

5. Displaying picture based on list box selection

6. enter data in a combo box based on value from another combo box

7. Limit subform combo box by selection in parent combo box

8. Populate a combo box from another combo box selection

9. Combo box selection narrows next combo box choices

10. Update a data combo based on selection in other data combo

11. Adding valuse to a combo box base on a value list

12. Handle Selection change in Combo/List Box in VB 5.0

 

 
Powered by phpBB® Forum Software