Results 1 to 8 of 8
  1. #1
    justgeig is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    45

    Initial "Customers" Table Planning


    I'm fairly new to the world of Access database programming. Been working through a very useful textbook on everything Access related and I think I'm ready to start making my initial tables and establishing relationships.

    In my "Customers" table, there are fields for FirstName and LastName as well CompanyName. I'd like to make all of those fields required to avoid missing information. The problem I'm running into is that some of our customers are only consumers and have no company name. On the flip side, some of our customers are businesses that have multiple people that can place orders. Obviously, I can't make all the aforementioned fields required because some of our customers legitimately don't meet all the conditions. I'm guessing that I'm missing a basic cornerstone of database design but looking through my book and google hasn't produced anything of value. I'd really appreciate any suggestions.

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    You might want to look at this tutorial
    http://www.rogersaccesslibrary.com/T...lationship.zip

  3. #3
    justgeig is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    45
    I will try to be a little more specific.

    In my "Customers" table, I want to ensure that either BOTH the "FirstName" and "LastName" fields are filled in OR the "Company" field is filled in for each record in the table.

    Not every customer is a business and not every business has just a single person that we deal with. Unless I am missing something still, the link you provided (while another good read for me) wasn't useful for this specific problem.

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    If they are all customers, then perhaps you could define Customers as an individual or Company with whom we do business. Then have a field to identify the type of Customer - individual/business.

    And a check within your logic for new/modified records such that

    if Individual then
    if len(lastname) = 0 or len(firstname) = 0 then
    error -need to fill Lastname and firstname
    ....

  5. #5
    justgeig is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    45
    I think I understand the concept and I think that would work.

    I just now thought of another idea to run past you. What if I were to have a table "Companies" and then a separate table "Contacts". Connect both of those in a one-to-many relationship to each of our publications (my company is a magazine publisher.) Then, either a company or a contact (individual not related to any business) would be able to place an ad into one of our publications. Then, I could have different fields for businesses that wouldn't apply to just an individual that places an ad.

    That may be too fragmented....? Or maybe some other problem?

  6. #6
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    What you are describing is a typical scenario where the actual business and business rules have NOT been defined. You aren't the first to go through this.
    My advice, and you can ignore it, is to write a 1 or 2 line description/definition of what a Customer is? What a Contact is? What a Company is? etc. You will learn more about what your business is and how things relate than you can imagine.
    The next thing will be how these things interrelate.

    I'd be cautious of using Contact. That is typically what we use for the representative at a company. Basically, our Contact at a specific company. You can use Contact providing the definition and use of it are consistent in your business.

  7. #7
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    You might also want to look at splitting it up. since you can have multiple customers at the same company have a company table and a customer table. Customer table would have a foreign key to the company table. Then in your query to get business customers use an Inner join to the company table. To get Individual customers query for company id = null.

  8. #8
    justgeig is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    45
    another good suggestion. Thanks to both of you!

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

Similar Threads

  1. Replies: 0
    Last Post: 01-11-2012, 12:34 PM
  2. Replies: 8
    Last Post: 08-05-2011, 02:55 PM
  3. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  4. "Group By" causes "ODBC--Call Failed" error
    By kaledev in forum Queries
    Replies: 1
    Last Post: 03-09-2011, 02:43 PM
  5. Replies: 21
    Last Post: 06-03-2009, 05:54 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