Results 1 to 5 of 5
  1. #1
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368

    query with relation in tables problem

    Hey Guys,

    I have a query based on a table with a lot of data (columns) in it.
    I needed to include some data (one column) from another table, so i added this table in the query and made a relationship between two columns with the same data from both tables.

    Now that access knows the relationship, i could add the column i needed to the query, so far so good.

    But when i delete a name from the second table, in stead of leaving the fields blanc in the main table, the query doesnt show these records.

    To clarify :

    Main table :

    Loads of data colums, ManagerName



    Second table :

    Some data, ManagerName, Phonenumber

    The query output :

    Loads of data, ManagerName, PhoneNumber

    When i delete a managers name from the second table, this manager and his phonenumber isnt showing up in the query result. I would like the output to be empty fields for the manager i deleted.

    Any thoughts ?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I assume you have joined the tables on ManagerName. Normally, a query will only show records where the ManagerName is the same in both tables. So, if ManagerName "A" is present in the big table, but there is no ManagerName "A" in the smaller one, then there can be no cases where there is a ManagerName "A in both, so no records are shown.

    However, your requirement is very common, and you solve the problem using an "Outer Join" between the two tables. If you are using the query design grid, right-click the link between the two tables, then click "Join Properties". You will see there are three options, with the default set as option 1. change the setting to Option 2 or Option 3 (All records in table....), and run the query. One of those will give you what you need, but I can't say which without seeing your design - it depend on how you set the query up.

  4. #4
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi, if you joined the 2 tables with an inner join on manager name, and then delete the manager name, the join can't find the linked record anymore and the result doesn't show up in the result. To show all records from one table and only those that match of the second, you need an outer join.

  5. #5
    nhorton79 is offline Advanced Beginner
    Windows 8 Access 2007
    Join Date
    Apr 2015
    Posts
    34
    If you just deleted the managers name (making it empty) but there was still a record for the phone number, then maybe you need to allow for nulls in your query.

    Try changing ManagerName in your query design to be
    Manager: nz([ManagerName],"")

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

Similar Threads

  1. Relation between tables
    By vincentsp in forum Forms
    Replies: 8
    Last Post: 02-03-2015, 08:53 AM
  2. how to make relation tables
    By Bala in forum Access
    Replies: 1
    Last Post: 11-07-2013, 06:35 AM
  3. Joining 2 Tables based on a Common Relation to Another
    By StudentTeacher in forum Programming
    Replies: 5
    Last Post: 07-26-2011, 07:23 AM
  4. Relation in three different tables
    By kzdev in forum Access
    Replies: 1
    Last Post: 11-22-2010, 03:12 AM
  5. Replies: 1
    Last Post: 11-12-2010, 08: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