Connecting Tech Pros Worldwide Forums | Help | Site Map

1 to Many Relation In a Subform

Newbie
 
Join Date: Dec 2006
Posts: 3
#1: Dec 11 '06
In my effort to create an order management database, I have established a one to many relation between my tables orders and order details.

Tables:
Orders: Customer, shipping method, etc. Primary key: OrderIndex
Order details: A list of products on this order. Primary key: DetailIndex

Relation:
OrderIndex occurs once in "Orders", but many times in "Order details"

My problem:
I have created a form that (supposedly, although not in actuality) will let me enter an order. It has a subform that will let me enter the details for that order, ie, the list of products. Unfortunately, the subform won't update OrderIndex to correspond to the parent form's OrderIndex. As a result, the data does not get stored correctly. Nor does it display correctly when I try to create a new order (all of the order details appear for the new order, in other words, the subform doesn't filter according to the parent forms OrderIndex). Does anyone know how to handle this? Also, if its a choice between macros and coding in VB, I'd rather go with VB.

Thank you,
Pete Stevenson

NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,722
#2: Dec 11 '06

re: 1 to Many Relation In a Subform


I'm no great expert here, but look at the Link Criteria between the Master and the Sub forms.
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,875
#3: Dec 11 '06

re: 1 to Many Relation In a Subform


Pete,

Can I just confirm that the tables are as follows:

Orders
OrderIndex (Primary Key)
Customer
shipping method

Order details
DetailIndex (Primary Key)
OrderIndex (Foreign Key)

In the relationships window can you confirm that the relationship is fully cascading. The cascade updates, deletes, etc. check boxes are all ticked in the properties of this relationship.

Mary
Reply