Query Problem

mousemat

Completely Self Taught
Local time
Today, 18:33
Joined
Nov 25, 2002
Messages
233
Whats wrong with this query?

=======================================
SELECT [Accident_Incident reports].ID, [Accident_Incident reports].[Report Number], [Accident_Incident reports].Type, [Accident_Incident reports].Location, [Accident_Incident reports].[Accident Category], [Accident_Incident reports].[Employee No], [Accident_Incident reports].JobTitle, [Accident_Incident reports].Department, [Accident_Incident reports].[Reporting Supervisor], [Accident_Incident reports].[Contract Employer Details], [Accident_Incident reports].[Injury Category], [Accident_Incident reports].[Injury Description], [Accident_Incident reports].[How Injury Occured], [Accident_Incident reports].Treatment, [Accident_Incident reports].[Treated By], [Accident_Incident reports].[Time Taken], [Accident_Incident reports].Disposition, [Accident_Incident reports].[Accident Book Entry], [Accident_Incident reports].Day, [Accident_Incident reports].Date, [Accident_Incident reports].Time, [Accident_Incident reports].Witnesses, [Accident_Incident reports].[Further Investigation], [Accident_Incident reports].[Investigation done], [Accident_Incident reports].[H&S Input Date], [Accident_Incident reports].[Describe Unsafe Act], [Accident_Incident reports].[Describe Unsafe Condition], [Accident_Incident reports].[Incident Analysis], [Accident_Incident reports].Reason, [Accident_Incident reports].[Potential Incident Severity], [Accident_Incident reports].[Probable Recurrence Rate], [Accident_Incident reports].[Actions Taken], [Accident_Incident reports].[Actions Required], [Employee Details].Surname, [Employee Details].Forenames, [Employee Details].[Home Address], [Employee Details].[Tel No], [Employee Details].DOB, [Employee Details].Sex, [Employee Details].[Fuji Seal Employee], [Lost Hours].[Hours lost], [Lost Hours].Month AS [Lost Hours Month], [Lost Hours].Year, Months.Month, [Type]="Accident" AS Accident, [Type]="Incident" AS Incident, [Accident_Incident reports]![Accident Category]="Minor" AS Minor, [Accident_Incident reports]![Accident Category]="Significant" AS Significant, [Accident_Incident reports]![Accident Category]="Lost Time" AS [Lost Time], [Accident_Incident reports]![Accident Category]="RIDDOR" AS RIDDOR, [Accident_Incident reports]![Disposition]="Return to work" AS [Return to Work], [Accident_Incident reports]![Disposition]="Sent Home" AS [Sent Home], [Accident_Incident reports]![Disposition]="Transferred to Other Work" AS [Transferred to Other Work], [Accident_Incident reports]![Disposition]="Sent to Hospital" AS [Sent to Hospital], [Accident_Incident reports]![Disposition]="Detained in Hospital" AS [Detained in Hospital], [Accident_Incident reports]![Disposition]="Return to Work from Hospital" AS [Returned to Work from Hospital], [Accident Book Entry]="Yes" AS [Acc Book EntryYes], [Accident Book Entry]="No" AS [Acc Book Entry No], Month([Date]) AS [Acc Month], Year([Date]) AS [Acc Year], [Witnesses]=Yes AS [Witness Yes], [Witnesses]=No AS [Witness No], [Further Investigation]="Yes" AS [Investigate Yes], [Further Investigation]="No" AS [Investigate No], Year([DOB]) AS [DOB year], [Acc Year]-[DOB year] AS Age, [Employee Details]![Fuji Seal Employee]="Yes" AS Employee, [Employee Details]![Fuji Seal Employee]="No" AS [Non employee], " " & [How Injury Occured] AS occur, " " & [Treatment] AS trement, [Forenames] & " " & [Surname] AS Name, [Lost Time Cost].[Hourly Cost]
FROM [Lost Time Cost] RIGHT JOIN (([Lost Hours] INNER JOIN ([Employee Details] RIGHT JOIN [Accident_Incident reports] ON [Employee Details].[Employee No] = [Accident_Incident reports].[Employee No]) ON [Lost Hours].[Report Number] = [Accident_Incident reports].[Report Number]) INNER JOIN Months ON [Lost Hours].Month = Months.ID) ON [Lost Time Cost].Year = [Lost Hours].Year
ORDER BY [Accident_Incident reports].ID;
============================================

Have been asked to look at this database but is driving me potty. Cant seem to work out whats gfoing on. There are 260 records. of which 212 are accident and 48 are incidents. when the qury is run i only get three incidents.

Anyone??
 
Hello

Could you convert it to A97?:)
 
Tay!

Hi Tay

Not long now before your in France

I have converted to Access 97 for you.

I will email you during the week too

Ian
 

Attachments

I'm not a query expert but I've got a feeling I know whats wrong.
Hooky data!

Take a look at 'qryNew' This shows that there are 45 'Incident' type records within [Accident_Incident reports] table that do not have a matching report number within the [Lost Hours] table.

I think this is why they are not getting carried through to your query results.
 

Attachments

Users who are viewing this thread

Back
Top Bottom