Results 1 to 8 of 8
  1. #1
    JGalt90 is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    13

    Post Related Record Required in Customers Table: PLEASE HELP


    Hi, I am trying to build a simple DB for a bread delivery route. I want to build a form from multiple tables, so when we get a call we enter all relevant data: [Customer Name Order Dates Quantity Product(s)] It is telling me related records are required in supplier and customer. I don't know what I am doing wrong. Is the design flawed? Thank you for any help, I greatly appreciate it. -JClick image for larger version. 

Name:	DBHelp2.jpg 
Views:	13 
Size:	139.5 KB 
ID:	20388
    Last edited by JGalt90; 04-20-2015 at 12:29 PM. Reason: Attachment

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I am blocked from downloading image. If you attached directly to post, I could then view it.

    A form can enter/edit data for only one table. You probably need to use form/subform arrangement. But why would there be a direct link between supplier and customer?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I would change the "OrderDetails" table.

    OrderDetails
    --------------
    OrderDetailsID (PK) (Autonumber)
    OrderID (FK) (Long)
    ProductID (FK) (Long
    Price
    Quantity

    Set an index on OrderID & ProductID to prevent duplicate entries.

  4. #4
    JGalt90 is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    13
    Thank you,

    I have attached the relationships.

    In stupid terms I just want "Oh Jim wants 2 6 inch rolls on sunday"

  5. #5
    keviny04 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Apr 2015
    Posts
    128
    Quote Originally Posted by JGalt90 View Post
    It is telling me related records are required in supplier and customer.
    It's likely because you are entering an order with a CustomerID that has yet to exist in the Customers table, and you are entering order details with a ProductID that has yet to exist in the Products table (and/or whose SupplierID has yet to exist in the Suppliers table). The referential integrity set in your relationships is causing this. Either you remove the R.I., or set up SEPARATE data entry forms for Suppliers, Products, and Customers. Before you enter an order, you have to go to those forms and ensure the suppliers, products, and customers that you are going to put in your order already exist.

    If you are good with form design and VBA, you can set up the order entry form so that if you try to enter a nonexistent supplier/product/customer, it will open up the necessary data entry form for you to enter it, and take you back to the order form.

  6. #6
    JGalt90 is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    13
    I don't understand why it isn't cascading or automatically updating the information

  7. #7
    keviny04 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Apr 2015
    Posts
    128
    Quote Originally Posted by JGalt90 View Post
    I don't understand why it isn't cascading or automatically updating the information
    You can't use cascade if a key record doesn't already EXIST in the parent table. Cascade can only UPDATE EXISTING records; it can't enter nonexistent records for you. In a one-to-many relationship, the parent table is on the "one" side, and the child is on the "many" side. The parent can have what the child doesn't have, but the child MUST have what the parent already has. In your case, that's why your orders (the child) must contain customers that are already in the Customers table (parent).

    That's why you need to enter new suppliers, new products, and new customers before you can enter orders. When you enter orders, you can only enter EXISTING suppliers, products, and customers. Unless, as I said, you are good with form design and VBA so you can create a way to process nonexistent records.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    It doesn't cascade or automatically update because there is no record to edit. Records must already exist in customers and products for selection in order record.

    You show only one form in the image. There should be several. Review comments in post 2. https://support.office.com/en-us/art...a-1e74d6f5f06b

    The customer and product tables records should not be editable from the order details form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 15
    Last Post: 03-05-2015, 03:30 PM
  2. Replies: 8
    Last Post: 06-26-2014, 08:52 AM
  3. Replies: 40
    Last Post: 08-20-2013, 11:38 PM
  4. Related Record Required
    By ungratefulninja in forum Database Design
    Replies: 7
    Last Post: 11-02-2012, 10:21 AM
  5. ...related record required...
    By degras in forum Forms
    Replies: 11
    Last Post: 11-03-2011, 12:20 PM

Tags for this Thread

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