|
-
Mar 9th, 2000, 07:04 AM
#1
Thread Starter
New Member
I am new to VB database programming so this may be an easy question, but any help would be appreciated.
The database I am using was orignally created in Access. In table A there is a combo box that gets is choices from table B. The combo box has a one-to-many relationship between table A and B. What I need to know is how on a VB form do I get my choices from table B and set the combo box to the choice that is selected in table A.
Thanks in advance for any help you can provide.
-
Mar 9th, 2000, 08:43 PM
#2
Addicted Member
The general idea is that you need to bind the ComboBox to the appropriate field of table A and then write code that opens table B and fill the ComboBox.
Fortunately, there are special ActiveX controls that will do the work for you. If you are using DAO, you can use the DBCombo control. If you are using ADO, it's the DataCombo control. Both of them come with VB.
The DataCombo control has 4 important properties, except of the DataSource, DataMember and DataField. The 4 properties are: RowSource, RowMember, BoundColumn and ListField. RowSource and RowMember are very similar to DataSource and DataMember. BoundColumn needs to be set to the name of the key field of table B and ListField to the name of the field you want to display in the ComboBox.
If you want more explanations, I think there's a VB sample of these controls that come with VB.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|