Results 1 to 3 of 3
  1. #1
    s@s is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2020
    Posts
    14

    Table structure/relation


    Hi all, first (theoretical) post for a noob user, so bear with me

    So I got a number of different customer types. They share some common fields, but they also got their own separate set of fields. so i thought i will make one table for each customer type (2-3 so far) instead of one big table.

    now, all customers, regardless of type, also got invoices with one of the invoice fields ofc being customer_id, i am thinking of making one invoice table common for all customer types.

    what would be the best practice to link invoices.customer_id with the several customer tables?



    1. Should i create a customer_type field as well inside invoices in order to distinguish invoices of customers with same id but different type?
    2. Should i include a prefix in each customer.id inside invoices/customers in order to distinguish invoices of customers of different type?
    3. Should i make a separate invoices table one for each customer type?
    4. any other approach?



    case 3 is clear i think but not that elegant: customersA.id=autonumber and invoicesA.customer_id=number and their relation is straightforward.

    how would i table-relate invoices with customers in the other approaches above?

    any feedback will be appreciated, thx!

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    They share some common fields, but they also got their own separate set of fields. so i thought i will make one table for each customer type (2-3 so far) instead of one big table.
    Without knowing your business and rules then 'as a rule' better to have one table and include a customer type field. Depends what you mean by separate set of fields but you can leave the ones that belong to another type blank (empty fields take up no space) or perhaps some can be multi purpose. Only issue would be if you were going to exceed 255 fields across all customer types

    1. see above
    2. no - the link back to customer does that
    3. definitely no
    4. see above

  3. #3
    Join Date
    Apr 2017
    Posts
    1,679
    In addition to Ajax response, about type-related customer info:
    1. If this info is unique for every customer, then go with fields in customers table. You may set the visibility of controls in form(s) linked to those fields true or false, depending on customer type;
    2. If for every customer type is certain value for every of those type-related parameters, then you can have a separate table, where those parameters for every type are set;
    3. If customer type can have some set of values value for at least some of those type-related parameters, then you need an additional field for subtypes, and a table, where parameters for every subtype of every type are set;

    For 2. and 3., type-related info about customer is read from type parameters table.

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

Similar Threads

  1. 3 Table Relation
    By Jon_4 in forum Access
    Replies: 1
    Last Post: 04-08-2020, 01:22 PM
  2. Replies: 2
    Last Post: 06-02-2018, 07:10 AM
  3. Table relation
    By Nandu_7 in forum Access
    Replies: 14
    Last Post: 08-12-2016, 12:06 PM
  4. Replies: 9
    Last Post: 03-08-2016, 03:25 AM
  5. Replies: 9
    Last Post: 08-06-2012, 01:45 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