Page 1 of 4 1234 LastLast
Results 1 to 15 of 47
  1. #1
    Peter Simpson is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Location
    South Africa
    Posts
    83

    Populating a query from two tables


    Hi
    I am new to Access so please bear with me.

    I have two tables (1) arpsOrderTbl and (2) arpsFeedbackTbl

    I want to design a query where the fields (Oder Date, ID Number, Surname, Service) from the arpsOrderTbl and the fields (Feedback Date, Feedback) from the arpsFeedbackTbl

    I tried creating a simple query however the query did not populate.

    Please help. I am very new to Access 2007 and am also not too good with understanding the relationships

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    in the query, join the 2 tables on the arpsOrderTbl.OrderID field. (the key fld)
    then you can bring in any fields from either table.

  3. #3
    Peter Simpson is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Location
    South Africa
    Posts
    83
    Thank you so much...That sorted it out.

    I can see only one problem now in my report.

    In the query there are two sets of feedback data for one customer, but in the report only one feedback is populated for that customer. the second feedback row in the query has been assigned to another customer who has no feedback populated yet.

  4. #4
    Peter Simpson is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Location
    South Africa
    Posts
    83
    the query

    Click image for larger version. 

Name:	Query.jpg 
Views:	16 
Size:	234.8 KB 
ID:	31062

    the Query datasheet

    Click image for larger version. 

Name:	Query datasheet.jpg 
Views:	16 
Size:	251.8 KB 
ID:	31063

    the report

    Click image for larger version. 

Name:	report.jpg 
Views:	16 
Size:	237.8 KB 
ID:	31064
    Attached Thumbnails Attached Thumbnails Query.jpg  

  5. #5
    Peter Simpson is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Location
    South Africa
    Posts
    83
    Can anyone help...I am really stumped.

    All I need on the report is to have the customers Order Date, Surname, Id Number, Service, Feedback Date and all the feedback listed so that I can see the history of the feedback from cradle to the grave.

    I know I am probably irritating everyone but I would really like to learn

    Thanks

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,928
    Your image doesn't show the tables and relationship link.

    Post the query SQL statement. Switch to SQL view to see the statement.
    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
    Peter Simpson is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Location
    South Africa
    Posts
    83
    Relationships

    Click image for larger version. 

Name:	Relationships.jpg 
Views:	12 
Size:	210.2 KB 
ID:	31079

  8. #8
    Peter Simpson is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Location
    South Africa
    Posts
    83
    SQL Statement for query

    SELECT arpsOrderTbl.[Order Date], arpsOrderTbl.Surname, arpsFeedbackTbl.[ID Number], arpsOrderTbl.Service, arpsFeedbackTbl.[Feedback Date], arpsFeedbackTbl.Feedback
    FROM arpsOrderTbl INNER JOIN arpsFeedbackTbl ON arpsOrderTbl.ID=arpsFeedbackTbl.ID;

  9. #9
    Peter Simpson is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Location
    South Africa
    Posts
    83
    Hi June7

    Thank you for your help

    I have posted what you have asked to see.....Please tell me you can help me

  10. #10
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Something seems wrong with your relationships Peter. You have firstname linked to ID? If this is true your database isn't set up correctly.


    Ideally each table should have a Primary key which is joined to a foreign key in another table.

  11. #11
    Peter Simpson is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Location
    South Africa
    Posts
    83
    Hi Andy

    hanks for that but I have no idea how to rectify that

  12. #12
    Peter Simpson is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Location
    South Africa
    Posts
    83
    Is this better? Sorry for being so slow but I am new at this and just want to learn

    Click image for larger version. 

Name:	Relationships.jpg 
Views:	11 
Size:	216.0 KB 
ID:	31082

  13. #13
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    All tables need a primary key labelled something like

    CustimerID_pk
    Serviceid_pk
    OrderID_pk

    And so on. These are your key fields.

  14. #14
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Then, which field in service table contains the customer number. This is your Foreign key and is labelled
    ServiceID_Fk

    Similar for order and feedback tables

  15. #15
    Peter Simpson is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Location
    South Africa
    Posts
    83
    Customer Table
    Click image for larger version. 

Name:	Customer Table.jpg 
Views:	12 
Size:	240.4 KB 
ID:	31083
    Service Table
    Click image for larger version. 

Name:	Service Table.jpg 
Views:	11 
Size:	163.6 KB 
ID:	31084
    Order Table
    Click image for larger version. 

Name:	Order Table.jpg 
Views:	12 
Size:	268.2 KB 
ID:	31085
    Feedback Table
    Click image for larger version. 

Name:	Feedback Table.jpg 
Views:	12 
Size:	255.6 KB 
ID:	31086

Page 1 of 4 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Auto Populating using multiple tables.
    By Huddle in forum Forms
    Replies: 2
    Last Post: 02-23-2015, 11:37 AM
  2. Populating unbound related tables
    By JoelBR in forum Access
    Replies: 11
    Last Post: 11-17-2012, 06:59 AM
  3. Populating ID in multiple tables
    By Dega in forum Database Design
    Replies: 18
    Last Post: 11-22-2011, 07:32 AM
  4. Access Form not populating from tables
    By Jim from Waconia in forum Forms
    Replies: 8
    Last Post: 04-01-2011, 03:35 PM
  5. PLEASE HELP - Two tables populating one form
    By intergnat1 in forum Forms
    Replies: 2
    Last Post: 03-17-2010, 07:20 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