Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    dhmlofi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    35

    Linking Form and a Subform to another Subform

    I`ve been using Access for years and am usually pretty good at figuring out my problems or finding the answers on forums but this issue has me really stuck so I`d appreciate some help please.

    I`m working on an Orders database. In the Products form, I`ve created a subform in datasheet view for ProductDetails. These details are for the variations of colour and size in the product along with their respective prices etc. As an example, the Product might be Garage Door A and the ProductDetails might be the likes of White Door 10 feet, White Door 8 feet, Red Door 11 feet, Red Door 12 feet (more complex than that but you get the picture). My client wants to be able to have it like this as there could be lots of variations of the one product.

    This seems to all work fine.

    The problem lies with my Orders form.

    In the Orders form, the main form contains the supplier, customer, order date etc, and there is an OrderDetail subform in datasheet view where the products need to be added - along with fields such as quantity, cost multiplier and net cost etc.

    My problem is that I can`t seem to get this subform to work. It worked fine in an earlier version of the database when the products were only on a form. As soon as I tried to split the products into products and product details I`ve run into problems.



    How do I combine the Product from the main Products form and the rest of the fields from the ProductDetails subform to appear in the OrderDetail subform. I`d like it to list Product then ProductDetail, e.g. Garage Door | White Door 8 feet | ..... (then things like cost, quantity etc)

    What I`ve found is that the OrderDetail subform displays each record in ProductDetail. And as my query has more than three forms with one to many relationships, I also can`t add a new record to the former.

    My relationships I think are set correctly.

    The Parent and Child link fields on Orders is the OrderID field.

    I know this is confusing to describe so I`ve uploaded a diagram of what I`m trying to achieve.
    Hope this makes some kind of sense!
    Click image for larger version. 

Name:	issue_order.jpg 
Views:	4 
Size:	63.1 KB 
ID:	11385
    Thanks
    Attached Thumbnails Attached Thumbnails issue_order.jpg  

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Pardon me, but it still sounds like you don't have the Master/Child relationships setup correctly. Without seeing your table structure or relationships it's a shot in the dark! If I understand correctly you have a order form with many products to choose from for that order, correct? Primary Key to Fake Key is the norm.On a one two many relationship. Some pics of your table structure and relationships and forms would be helpful.

  3. #3
    dhmlofi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    35
    Thanks burrina. I`m attaching some images.

    If it helps in explaining it, the way the database was until now, each variation of the products was a separate record and there was no subform. Let`s say that for supplier A there was 50 products. When it came to the dropdown boxes on the Order subform, the list of products was very long (even though each order form is using only one supplier and so the order subform is filtered to show only products from that one supplier). My client therefore wants to have the ability to separate the products and the sizes so that the dropdown lists are shorter. So Supplier A would have 5 products each with 10 sizes.
    Click image for larger version. 

Name:	issue1.jpg 
Views:	8 
Size:	158.4 KB 
ID:	11389Click image for larger version. 

Name:	issue2.jpg 
Views:	4 
Size:	89.8 KB 
ID:	11390
    Attached Thumbnails Attached Thumbnails issue1.jpg   issue2.jpg   issue3.jpg  

  4. #4
    dhmlofi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    35
    and here`s the images of the forms...
    Click image for larger version. 

Name:	issue3.jpg 
Views:	4 
Size:	149.8 KB 
ID:	11392
    Click image for larger version. 

Name:	issue4.jpg 
Views:	4 
Size:	142.6 KB 
ID:	11393

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Impressive screenshots and yes, I think your relationships appear to be in order. I am curious about this query though? If you run the query, can you do what you want? i.e. add/edit data? Does this end result look like you want it to? So, just to be clear, you have a customer that places an order and then you enter products on this subform for that order? You say you can't add records on this subform? Also what happens when you start using more than one supplier, how are you going to address this? Also, is the ONLY issue is that you need to filer the combobox better? This is accomplished of course via the query for that combo! Could you post a screenshot of the combo query and describe in detail what you want it to do?
    Last edited by burrina; 03-03-2013 at 01:25 AM. Reason: Questions?

  6. #6
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Excuse me butting in, there is a mistake in your relationships: OrderDetail should be related to ProductDetail and not to Product.

  7. #7
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    I did not catch that, true! Maybe that will solve his problem!

  8. #8
    dhmlofi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    35
    Thanks both of you. Do I need to link OrderDetailID to ProductDetailID or ProductID?

    When I try the former it gives me a one-to-one relationship and when I try the latter it gives me a one-to-many but doesn`t indicate a 1 against OrderDetailID like I`d expect it to. I thought I`d have needed a many-to-many as I`ll have more than one orderdetailID with more than one productdetailID.

    So I`m confused as to which it should be??

    Thanks again

  9. #9
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    OrderDetailiD to ProdoctDetailID

  10. #10
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    To elaborate: remove ProductID from OrderDetail after deleting relationship with Products; add ProductDetailID as a foreign key; create 1:m relationship between ProductDetailID (PK on ProductDetail) and ProductDetail (FK on OrderDetail).

  11. #11
    dhmlofi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    35
    Many thanks both of you again. I`ll give it a go and report back.

  12. #12
    dhmlofi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    35
    Many thanks both of you again. I`ll give it a go and report back.

  13. #13
    dhmlofi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    35
    I`d like to take this one step at a time as I know my query was also very mixed up. So can I please ask you to take a look at the screenshot and let me know if the relationships are now as they should be? Although I`m not seeing the 1 and infinity symbols on the new relationship, it does say it`s a one-to-many.
    Click image for larger version. 

Name:	issue5.jpg 
Views:	5 
Size:	60.1 KB 
ID:	11398

  14. #14
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Looks good to me. However, what you speak of is when you check off Enforce Reverential Integrity! Sometimes this is not possible if you already have data in the tables.

  15. #15
    dhmlofi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    35
    Hi again. Ok, thanks burrina for the Enforce Ref Int note, that solved that...appreciated. And thanks Rod for the detail on updating the Relationships...a huge help. I have been working on my query and am several steps ahead and actually thought I had it working! But I have come up on another hurdle that has me stumped.

    I`m now able to add new records in the OrderDetails subform and have set up combo boxes to filter the product info. In the attached images you will see the message I get when I try to open the combo for ProductDetailID. I need it to pick the ProductID from the current subform record and from the parameter box, I can`t see how this is the wrong one I`m selecting. But whichever way I try, it`s not working.

    As a note, Rod, you said to remove ProductID from OrderDetail which I did, but ended up having to put it back in as I need them to first select the product (productID) before selecting the customization of it (ProductDetailID).

    Again, I`d appreciate your input. Thanks

    Click image for larger version. 

Name:	issue6.jpg 
Views:	4 
Size:	84.1 KB 
ID:	11422

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 04-17-2012, 10:28 AM
  2. Subform to subform linking
    By Mitka in forum Forms
    Replies: 1
    Last Post: 01-15-2011, 03:43 PM
  3. Access 2003 subform linking problem
    By RANCHLAW56 in forum Access
    Replies: 1
    Last Post: 12-26-2010, 05:35 PM
  4. Form - subform linking problem
    By Justin in forum Access
    Replies: 1
    Last Post: 11-11-2010, 11:21 AM
  5. Linking Subform Control to Main form
    By KWarzala in forum Forms
    Replies: 1
    Last Post: 03-13-2010, 08:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums