Results 1 to 11 of 11
  1. #1
    whistler is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    26

    Unbelievable Response from Access


    Hello. I would like to first say that Access is good; however, I have been unable to answer how to get the database query to produce a list of all clients, even if they don't have any interactions. I've attached a few files for your review. Would you kindly take a look and see if you can pinpoint how to get a list of all clients, even if there were no interactions? Thank you,
    Whistler

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Probably has to do with the jointype. An INNER join will retrieve records only when there are related records in both tables. Probably need RIGHT join. Looks like the join is okay between Clients and Interactions but not sure about Clients and Group-Client. Would need to analyse the project directly if you want to provide it.
    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
    whistler is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    26
    Thanks for your reply. Here are the details:

    SELECT [010 Clients].[Client Segment], [010 Clients].[First Name], [010 Clients].[Middle Name], [010 Clients].[Last Name], [010 Clients].[Name Suffix], [011 Group].GroupName, [011 Group].GroupTypeID, [011 Group].GroupID, [010 Clients].[Contact Type], [010 Clients].[Client ID], [015 Role].RoleID, [015 Role].RoleDescription, [050 Interactions].InteractionsID, [050 Interactions].Date, [050 Interactions].NB, [050 Interactions].Owner, [050 Interactions].Summary, [050 Interactions].Venue
    FROM [015 Role] INNER JOIN ([011 Group] INNER JOIN (([013 Group-Client] INNER JOIN [010 Clients] ON [013 Group-Client].ClientIDNumber = [010 Clients].[Client ID]) LEFT JOIN [050 Interactions] ON [010 Clients].[Client ID] = [050 Interactions].ClientIDNumber) ON [011 Group].GroupID = [013 Group-Client].GroupID) ON [015 Role].RoleID = [013 Group-Client].RoleID
    WHERE ((([011 Group].GroupTypeID)<>3) AND (([010 Clients].[Contact Type])="Client") AND (([050 Interactions].Date) Between #1/1/2011# And #12/31/2011#));

    Your assistance is greatly appreciated,
    Whistler

  4. #4
    whistler is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    26
    One other comment...my objective is to show a list of all clients in the query results, including both those that have interactions (i.e. conversations during a certain time period) as well as those that do not have interactions. That way, I will know who I haven't contacted recently. Currently, the query provides an output only showing clients who have had interactions.

    Thanks very much as this is important to me,
    Whistler

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    review the left join examples here
    http://www.w3schools.com/sql/sql_join_left.asp

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    All I can do is suggest you test modifying the jointypes. I would have thought the join between clients and interactions would be RIGHT (but then I always have a hard time recognizing what is a LEFT or RIGHT situation). Then there are all those INNER joins that probably should be LEFT or RIGHT. Try testing a query with just the two clients and interactions tables. Then see what happens as you include each of the others. It is possible these cannot all be joined in one query and get what you want.
    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
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Another option to try is to use a subquery. I have a hard time creating them so I use two queries.

    Create a query with two tables: "Clients" and "Interactions" (qryCI_010_050).

    Code:
    SELECT [010_Clients].ClientID, [010_Clients].FirstName, [010_Clients].MiddleNmae, [010_Clients].LastName, [010_Clients].NameSuffix, [010_Clients].ClientSegment, [010_Clients].GroupName, [010_Clients].GroupTypeID, [010_Clients].[Contact Type], [010_Clients].GroupID, [010_Clients].[Client Segment], [050_Interactions].InteractionsID, [050_Interactions].ClientIDNumber, [050_Interactions].InteractionDate, [050_Interactions].NB, [050_Interactions].Owner, [050_Interactions].Summary, [050_Interactions].Venue
    FROM 010_Clients LEFT JOIN 050_Interactions ON [010_Clients].ClientID = [050_Interactions].ClientIDNumber;
    Once it is returning the data you want, create another query with the other tables and the qryCI_010_050.


    NOTE: "Date" is a reserved word in Access and a function; it shouldn't be used for object names. Also, it is not a good idea to use spaces in object names.
    http://allenbrowne.com/AppIssueBadWord.html
    http://access.mvps.org/access/tencommandments.htm

    Somewhere years ago, I read that you should not use a number as the first character of an object name. Can't find anything like that Googling, but I never have a number as the first character .

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I haven't had problem with numbers, even as first character, in Access. However, special characters and punctuation (underscore is exception) could cause issues and should be avoided in names as well as data.
    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.

  9. #9
    whistler is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    26
    Although I have not fully resolved this issue, I have been trying the suggestions that June7, orange, and ssanfu have made here (thank you!). I created a new query with just the Client and Interactions tables, as shown on the current attachment. That worked properly. However, I haven't figured out how to re-add the Group, Group-Client, and Role tables, which were described in the uploaded documents in my original post. Any suggestions? I have not had time to make updates to the object names but will soon.

    Thanks for your efforts, and I am looking forward to your reply.
    Whistler

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I would need the data to test if you want to provide.
    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.

  11. #11
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by whistler View Post
    Although I have not fully resolved this issue, I have been trying the suggestions that June7, orange, and ssanfu have made here (thank you!). I created a new query with just the Client and Interactions tables, as shown on the current attachment. That worked properly. However, I haven't figured out how to re-add the Group, Group-Client, and Role tables, which were described in the uploaded documents in my original post. Any suggestions? I have not had time to make updates to the object names but will soon.

    Thanks for your efforts, and I am looking forward to your reply.
    Whistler
    Create a NEW query. Add the Group, Group-Client, and Role tables, then add the query (Query1 - from the PDF). Create the links (set the join type), drag down the fields, execute the query.

    A query does not have to contain ONLY tables; it can contain:
    only tables, or
    only queries (as in a union query)
    or a mix of tables and queries.

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

Similar Threads

  1. Replies: 3
    Last Post: 07-12-2011, 02:02 PM
  2. Slow response over VPN or To Filter or not To Filter
    By rcrobman in forum Database Design
    Replies: 0
    Last Post: 04-30-2011, 02:37 PM
  3. Often get no response from access
    By Grooz13 in forum Access
    Replies: 6
    Last Post: 08-13-2010, 10:51 AM
  4. Slow Database Response
    By Nixx1401 in forum Access
    Replies: 3
    Last Post: 02-25-2010, 11:09 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