Results 1 to 12 of 12
  1. #1
    TomAtSBio is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Jun 2021
    Posts
    4

    2 customer tables?

    Greetings all,


    I'm a access newb and I've been tasked with creating a database for my jobs customers and their equipment leasing.
    The issue Im having is that one customer may be the parent company to many other customers, and all of them will be leasing equipment.
    Later in the project I am to create a form for a contract renewal where the parent company will be billed for the equipment at all of the equipment at their facility and the equipment at other customers who they are the parent company for.

    Will his require 2 customer tables with all of the same customers in each?

    Any 1 customer may own some of the others, like when a dentist office acquires another practice and then owns all of their original practices and the ones they just purchased.

    Also what kind of relationships would then need to be made.

    I have been watching some udemy courses, but this example does not seem to be covered.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    I would use ONE tCustomer table
    never duplicate data

    and another table to hold all companys having customers linked say: tCoCustomers
    CoID, CustID

    then 1 customer can exist in many companies.

  3. #3
    TomAtSBio is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Jun 2021
    Posts
    4
    Please see the pic below. Is this what you mean?
    The parent companies will lease equipment as well, so I tried to tie the parent company table to the equipment table and the customer table to the equip table as well.
    Not sure if this is correct though.

    I have also added a tax table as I must correlate a tax rate to the customer which is set by their county/state.
    Does this seem correct?
    Click image for larger version. 

Name:	Untitled.png 
Views:	56 
Size:	21.1 KB 
ID:	45545

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    it still looks like double employee tables.
    tCompany should only be company data. No people.
    only 1 tCustomer table

    a joining table tCoCustomers with 2 flds
    CoID, CustID

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,936
    I'd probably have a field for parent id, and it would be perhaps null or zero if a parent company?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I recommend you tell us about your "business/opportunity" in simple, plain English.
    Perhaps you could describe " a day in my business". Or an example of a "Customer leases equipment......"
    Sounds like job may be involved as well as contract, but need clarification.
    What is it in your business that would require you to record company/customer hierarchy?

    From an Access perspective, you should avoid names with embedded space(s).

  7. #7
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You should not have spaces in object names
    There should not be punctuation or special characters (except the underscore) in object names.


    Consider:
    Click image for larger version. 

Name:	Lease.png 
Views:	48 
Size:	117.2 KB 
ID:	45546

    ParentCompanyID_FK = 0 when company is a Parent company.
    ParentCompanyID_FK = CompanyID_PK when a company is contracted to a parent company



    This is how I would begin.... you really have not given enough (any) info on what the process is or the requirements.



    "Old Programmer's Rule" is this: If you can't do it on paper, then you can't do it in Access. Until you can draw out your tables AND rules for how they change for each function you want to perform, you are going nowhere fast.

  8. #8
    TomAtSBio is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Jun 2021
    Posts
    4
    OK. My customers tbl was copied from M$'s Northwind example. I will refrain from using spaces/punctuation/special characters in the object names. Thnx

    For my job:
    I work for a service company and we have many customers that purchase service agreements to cover the equipment they own.
    The service agreement cost will be determined by the amt of equipment they own. (each piece of equip has an associated cost shown in my table above)
    Some customers are parent companies to other customers, so the bill for the service agreement covering the parent company and their sub-companies must be sent to the parent company.
    That being said, the parent company will be in one county of a state and their sub-companies in other counties, each with their own tax rate (which changes often), so I will later build a report that shows the parent company and their service agreement covering their equipment and then all of their sub-companies and each of their equipment inventories along with the total price of the agreement and the sales tax for each.
    Any customer in our list may be a parent company and this is always subject to change as one customer may purchase another and become the parent.

    So in the end, we will use the db to:
    1. log and create the service contract
    2. total the equipment price which will then be the service agreement cost
    3. We must be able to change the tax rates easily
    4. swap the equipment from one customer to another as it may be sold from one to another or sometimes trashed
    5. Show the relationship of parent company and sub-companies

  9. #9
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    DB based on ssanfu's schema. See if this is on the right track.

    TomAtSbio-davegri-v01.zip

    Attachment 45548

  10. #10
    TomAtSBio is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Jun 2021
    Posts
    4
    Thank you for the reply. Ive been looking at the relationships and it seems so straight forward.
    I am going to keep looking into all the parts of this.
    BTW what does
    Code:
    Call ClearAll("Dummy")
    do when the Clear all sub is called?
    What is a dummy ctl?

  11. #11
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Quote Originally Posted by TomAtSBio View Post
    Thank you for the reply. Ive been looking at the relationships and it seems so straight forward.
    I am going to keep looking into all the parts of this.
    BTW what does
    Code:
    Call ClearAll("Dummy")
    do when the Clear all sub is called?
    What is a dummy ctl?
    It's just a workaround. ClearALL requires an argument. The argument is the combobox name NOT to clear. When I want to clear all the comboboxes, I just send it the string "Dummy", which it won't find a match for, and all the comboboxes get cleared.

    Bye the way, I have an enhanced version with some bug fixes here:
    Edit: The new version has some more functional queries as well.

    TomAtSbio-davegri-v02.zip
    Last edited by davegri; 06-26-2021 at 05:30 PM. Reason: See Edit

  12. #12
    Cotswold is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2020
    Location
    Cotswolds, England
    Posts
    2
    What you want to do is fairly standard stuff.
    Your final invoice will be to the main account and the main account will have sub accounts, depots or sites.
    In your customer Table there will be the Account Code to match accounts for the Parent and a Sub Code for the Child accounts, to which you will add charges.
    This came up on another Forum where someone needed help on creating an invoice header and the invoice charges related to the header. I described the
    process that I have used for more years than I can remember in a PDF, which I attach. I suggested that there is no need for an invoice header Table and an
    Invoice body Table. The PDF should explain. The Tax or VAT is covered.

    Maybe you will find this helpful.
    Attached Files Attached Files

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

Similar Threads

  1. Replies: 22
    Last Post: 06-04-2020, 08:31 PM
  2. Replies: 7
    Last Post: 08-06-2016, 07:05 PM
  3. Replies: 6
    Last Post: 12-11-2013, 09:27 PM
  4. Replies: 1
    Last Post: 12-24-2011, 08:48 AM
  5. Replies: 1
    Last Post: 08-19-2009, 01:14 AM

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