Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2010
    Posts
    14

    Unanswered: Query not returning expected results

    I have created a query in Access 2007 to return the address information for one contact with the account information for a related contact. I have set up a junction table in order to form the the connection between the contact and related contact but the query I set up pulls up the address information and the account information for the related contact not the address for the contact and the account info for the related contact. Code is below can you tell from this what is wrong?

    SELECT [CYAM Relationships].[Contact ID], [CYAM Contacts].Prefix, [CYAM Contacts].[First Name], [CYAM Contacts].[Last Name], [CYAM Contacts].Company, [CYAM Contacts].[Addr Line 1], [CYAM Contacts].[Address Line 2], [CYAM Contacts].City, [CYAM Contacts].State, [CYAM Contacts].Zip, [CYAM Relationships].[Related Contact], [CYAM Contact Account Numbers].[Account Number 1], [CYAM Contact Account Numbers].[Account 1 name], [CYAM Contact Account Numbers].[Account Nubmer 2], [CYAM Contact Account Numbers].[Account 2 name], [CYAM Contact Account Numbers].[Account Number 3], [CYAM Contact Account Numbers].[Account 3 name], [CYAM Contact Account Numbers].[Account Number 4], [CYAM Contact Account Numbers].[Account 4 name], [CYAM Contact Account Numbers].[Account Number 5], [CYAM Contact Account Numbers].[Account 5 name], [CYAM Contact Account Numbers].[Account Nubmer 6], [CYAM Contact Account Numbers].[Account 6 name]
    FROM ([CYAM Contacts] INNER JOIN [CYAM Relationships] ON [CYAM Contacts].[Contact ID] = [CYAM Relationships].[Related Contact]) INNER JOIN [CYAM Contact Account Numbers] ON [CYAM Contacts].[Contact ID] = [CYAM Contact Account Numbers].[Contact ID];
    Last edited by Vallynmar; 01-06-11 at 12:47. Reason: adding verson

  2. #2
    Join Date
    Nov 2010
    Posts
    84
    Maybe a mistake in the field [Account Nubmer 2] and [Account Nubmer 6]
    Perhaps there should be [Account Number 2] and [Account Number 6]
    Last edited by eremija; 01-07-11 at 14:23.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •