Results 1 to 8 of 8
  1. #1
    MSAccessNewGirl is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    4

    Managing Contacts in a multi-tier database

    I have created a database which we are going to use to track various projects at work. The main table is Company (ID_Company is the primary key), which relates to Company_Address (ID_COMPANY and ID_COMPANY_ADDRESS are the primary keys), which relates to Company_Contacts (ID_CONTACT and ID_COMPANY_ADDRESS which are the primary keys), and Project (ID_PROJECT and ID_COMPANY are the primary keys). The idea of the database is to first add a Company name. Next, you can fill in the address of the company (expecting that there could be several different addresses for a given company ... ie. offices could be in New York and in Denver). Each address has the ability to have both Contacts and Projects assigned to it. I have set up relationships on each of the tables already.

    My issue is being able to add new contacts and/or projects for a given address. I am completely unfamiliar with using VBA and would prefer to use Macros so that I can recreate what has already been done. I am attaching a copy of the database with the hope that someone can assist me! Thanks so very much for any help!
    Attached Files Attached Files
    Last edited by MSAccessNewGirl; 02-26-2014 at 04:57 PM. Reason: Added new contacts dbs

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I opened the Company_Projects Subform (you have a misspelling in the name as Subforum) and it looks exactly like the Contacts Subform.

    What exactly is the 'issue' you have with adding new contacts and/or projects for a given address? Do projects really need to be associated with specific address? Then have field for Address ID instead of Company ID in Project table.

    I don't think you should have compound primary keys.
    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
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    See thes
    Is this what you want
    Attached Files Attached Files

  4. #4
    MSAccessNewGirl is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    4
    Sorry, it isn't. I need to be able to add Contacts & Projects to a given Company Address.

  5. #5
    MSAccessNewGirl is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    4
    Yes, you are correct ... the Projects subform looks just like the Contacts subform. What I am trying to accomplish on each of these is the same. I have attached a modified dbs.

    I have to have contacts associated with a company at a specific address because we may deal with several offices of a given company; thus, each office has different personnel working there and each office will have different projects. Because of this, I believe that I need compound primary keys. Am I incorrect?

    I have tried to use SetTempVar on the Contacts Button (On Click, using a Macro); however, it is not working.

    Thanks so much for your help!

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    No db attached to your last post.

    Still don't see need for compound key.

    The primary key for Project table is ID_Project. ID_Company in that table is a foreign key.

    Similar case for Address and Contacts.
    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.

  7. #7
    MSAccessNewGirl is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    4
    Sorry. I loaded the second Contacts database under my original message ... it's the larger file.

    Can you then show me how I should set up the database so that I can do the following:
    - Have one entry for each Company
    - Have multiple addresses for each Company
    - Have multiple contacts for each company address
    - Have multiple projects for each company address

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Again, I still don't think compound keys are required but will probably work anyway.

    Table structures seem good. Don't think should be INNER joins on the relationship links.

    I am sure you are aware the embedded macros for the buttons are not working. I don't use macros, only VBA.

    You could set the CustomerAddress subform as Single view then have the Projects and Contacts forms as subsubforms.

    Here is a method to have the Contacts and Projects subforms sit next to the Addresses subform: http://www.fmsinc.com/MicrosoftAcces...edSubforms.asp

    Can each project can have only one company address?
    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. Database design help for multiple contacts
    By newbieX in forum Database Design
    Replies: 6
    Last Post: 12-09-2013, 06:54 PM
  2. Replies: 1
    Last Post: 09-28-2012, 11:34 PM
  3. Replies: 6
    Last Post: 05-11-2012, 11:16 AM
  4. Contacts Database and Email system
    By steve1978 in forum Access
    Replies: 1
    Last Post: 02-16-2011, 09:42 AM
  5. Contacts Database
    By karthikcoep in forum Access
    Replies: 0
    Last Post: 08-17-2009, 02:02 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