Linked combo box

fshrago

Member
Joined
Sep 6, 2006
Messages
11
Programming Experience
5-10
I have a form based on one table that is on the one side of a one to many relationship.

I need to create a combo box that is linked to the many side.

ie:

Purchases: (one side)

PurchaseID
PurchaseName
CategoryID (foreign key)

Categories: (Many side)

CategoryID (Primary Key)
Category Name

I have 2 binding sources in the form: BSCategories which is linked to the Dataset and category table and BSPurchases which is linked to BSCategories and to the datarelation.

If I set the datasource of my comb to bscategories.categoryname then I cannot move past the 2nd record (the first 2 records use the same category and then it changes)

New to creating relational forms so any SIMPLE examples would be appreciated!
 
As your Categories is a lookup, I would say you don't need a relation, I don't use any for my lookup tables.

Anyhow, you would set the combobox to have a dataSource, a displayMember and a valueMember. You also need to set it's DataBinding.

I.E.

With me.combobox1
.dataSource = DataSet1.Categories
.displaymember = "Category Name"
.valuemember = "CategoryID"
.databindings.add("SelectedValue", dataSet1, "Purchases.CategoryID")
End With

Hope thats of some help...
Luke
 
Back
Top