showing a query result in employees records

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aaron5150
    New Member
    • Mar 2008
    • 1

    showing a query result in employees records

    OK so here goes.

    I have created a table for my "employees details" including "employee number". I have also completed another table which shows orders by "employee number", details of order etc.

    I created a query which shows each employee on its own line with a "total number of the orders taken" by the employee rather than a random list showing each individual order. so for example it shows:
    Employee ID Total Orders
    Employee 1 3
    Employee 2 9
    Employee 3 7

    So now on the "employee details" screen I want to be able to show the total number of orders taken by that individual employee without listing each individual order and date. Every time i try it in a combo box it keeps showing every employees totals in a list rather than just that employee.
    so for "employee 1" it shows:
    3
    9
    7
    instead of just 3,

    How can i make the combo box only show the total for that employee?
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Originally posted by aaron5150
    ...so for "employee 1" it shows:
    3
    9
    7
    instead of just 3,

    How can i make the combo box only show the total for that employee?
    Hi. Seems like you are missing a join between the employees table and your employee order count query - the join would normally be on employee ID or reference number. Without the join you get what is known as the Cartesian product of the rows of the table with the rows of the query - which will indeed show all totals for every member of staff. Could you check this, and post the SQL of the recordsource query for your combo if you are unable to resolve it? It would also be useful to know what the primary key of your employee table is. You will need to include this field in the order count query as well, so you can join the query back to the relevant employee.

    -Stewart

    Comment

    Working...