Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relationships Correct? (Picture Included)

Status
Not open for further replies.

MagnusFox

IS-IT--Management
Jan 12, 2001
51
US
Please follow the links below to see the visual stuff, it will help!

I have the start of a system that redeems promotions for customers. Here is the portion of the relationships we are concerned with now:
Does anything look bad there?

Each customer can redeem a single promotion once, but may redeem many different promotions. Each promotion may have sub promotions. An example would be a promotion for Beef: Buy a case of Rib eye, get $10, and/or buy a case of Rump roast and get $4. You can see promotions working here:

So far no problems. Now I want to create some redemptions. Here is the beginning of the Redemptions form:
You can see that the main form has two similar sub forms. The top form queries to find the related sub promotions matching the promotion selected in the upper right hand corner. That works fine. However, I need to be able to enter the quantity the customer is redeeming for each sub promotion. I need to store that value for the combination of Redemption ID, Promotion ID and Sub Promotion ID. You can see what the form should look like in the lower sub form. However, I populated the table manually.

I need to be able to store the quantities, as in the second sub form from the main form. I need to do this in the following way: Go to Redemption Form (Get new Redemption ID), Choose Customer (Get Customer ID), Choose Promotion (Get Promotion ID), sub form displays the related Sub Promotions and has the input boxes to enter in the quantity for each sub promotion.

Here is the SQL code for each of the sub forms:

Please help! Many thanks.
 
Set the default value for each of your controls to the control that it needs:

Main SubForm
=[Forms]![MyFormName]![PromotionID]

Referencing SubForm Value
=[Forms]![MyFormName]![MySubFormName].Form![ControlNameOnSubform] Joe Miller
joe.miller@flotech.net
 
You have created a duplicate many-to-many join between Promotion and Subpromotion. This is not typical and could cause you numerous problems.

If you wish to limit a customer to a single promotional redemption then you should include the customerID in a compound key in the link table between customer and redemption. As such, I would recommend you have a link table that includes the customerid, promotionid, and subpromotionid. For the PK of this table I would have a compound key using promotionid and customerid. I would eliminate the current configuration for your redemption.

Basically, what I'm saying is you should leave the Promotion, Promotion Detail, and SubPromotion relationship as is. Eliminate the redemption relationship and change the table structure to better facilitate what I think you're trying to achieve.

I'm going to assume you want to allow a customer to take part in any or all promotions. That for any promotion they may choose a subpromotion(if applicable), but at any rate they can only take part in the promotion one time no matter which subpromotion they choose. If this assumption is correct your table structure and relationships should be changed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top