Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Relationships Correct? (Picture Included)

Relationships Correct? (Picture Included)

Relationships Correct? (Picture Included)

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.


RE: Relationships Correct? (Picture Included)

Set the default value for each of your controls to the control that it needs:

Main SubForm

Referencing SubForm Value

Joe Miller

RE: Relationships Correct? (Picture Included)

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close