Blank or Duplicate return from query?

Sam Summers

Registered User.
Local time
Today, 10:12
Joined
Sep 17, 2001
Messages
939
I have searched for an answer and spent some hours but still not getting it.

I have played about with the query joins and still nothing?

I have never had this problem with my database in 5 years (well not that i have noticed).
Some records are fine others are triplicated and quite a lot are blank?

This is the SQL for the query.

SELECT Employee.EmployeeID, Employee.FirstName, Employee.Surname, Employee.Address, Employee.[Town/City], Employee.Region, Employee.DateofBirth, Employee.Nationality, Employee.MaritalStatus, Employee.PassportNo, Employee.ExpiryDate, Employee.Nextofkin, Employee.Relationship, Employee.NOKAddress, Employee.ContactNo, Certificate.CertName, EmployeeCert.Level, Trade.TradeName
FROM Certificate INNER JOIN (Trade INNER JOIN ((Employee INNER JOIN EmployeeCert ON Employee.EmployeeID = EmployeeCert.EmployeeID) INNER JOIN EmpTrade ON Employee.EmployeeID = EmpTrade.EmployeeID) ON Trade.TradeID = EmpTrade.TradeID) ON Certificate.CertID = EmployeeCert.CertID
WHERE (((Employee.EmployeeID)=[Forms]![Employee]![EmployeeID]) AND ((Certificate.CertName)="IRATA"));

Basically i have to solve this problem.

I have a report that is based on this query and if the employee is not displayed correctly instead of the employees Name and Surname i am getting "#Error" ?

Many thanks in advance
 
Sam,

You may want to check for duplicates within each of the stated tables.
For each of the join fields for each of the tables, group by the primary key and count the number of instances.
You will probably find that you have duplicate data in one of the tables and this would cause duplicates in the query.

I would check each of the following fields individually to see if there are dupes:
Employee.EmployeeID
EmployeeCert.EmployeeID
EmpTrade.EmployeeID
Trade.TradeID
EmpTrade.TradeID
Certificate.CertID
EmployeeCert.CertID
 

Users who are viewing this thread

Back
Top Bottom