View Full Version : Displaying Data from Tables with Multiple Keys


sagewind
02-04-2010, 07:22 AM
I am administering a 2003 Access Training Database. The key in my EmpInfo table is the Employee ID number. On 1-Jan my data download from VISTA was expanded to include multiple divisions of the company. There are duplicate Employee ID numbers across the divisions. If I change the key to include Employee ID and Division No, I am finding it very difficult to reconcile other functions I have in place already. Specifically, have an employee info screen with tabs. When you enter the Emp ID the person's training records are listed on one of the tabs. This used to be guided off the Employee ID, but now where the duplicate Employee IDs occur, both employees display the same records. How can I tell my function/query that it needs to look at both the Employee ID and the Division to differentiate between the two employees?

pbaldy
02-04-2010, 08:01 AM
I have a similar situation. I typically have a listbox on a main menu form where users select a company. Queries and such all look at that listbox to restrict records to the selected company. That works for me as users are typically working on one company at a time, not switching back and forth.

vbaInet
02-04-2010, 08:06 AM
add an AND statement in the WHERE clause of your sql statement.

E.g.

... WHERE X = 1 AND DivisionNo = " & txtBox_Division.value & ";"

Late post.:)