Kamis, 19 September 2013

[MS_AccessPros] (SQL) Query Builder

 

This query works for selecting one department at a time. The HR department would like to select or group departments to display on the resulting report that is displayed by this forms combobox [Forms]![F_Accident_by_AREA]![Dept_FormCombo]. Currently you can select:

Fabrication
Weld Line
Weld
Paint
Clean
Crane
Assembly
Hydraulics
Final Detail

The HR department would like to group Weld & Weld Line, Paint & Final Detail, ect and other groupings. Is there a way to change my query or do I need a new approach for the Form/Query/Report process I am using?

Thanks, Rohn

SQL QUERY BUILDER:
SELECT [T_Personal Injury Accidents].Department, [T_Personal Injury Accidents].[Date of Accident], [T_Personal Injury Accidents].[Description of Accident], [T_Personal Injury Accidents].[Corrective Action 1], [T_Personal Injury Accidents].[Corrective Action 2], [T_Personal Injury Accidents].[Corrective Action 3], [T_Personal Injury Accidents].[Corrective Action 4], T_Departments.[Dept#]

FROM T_Departments INNER JOIN [T_Personal Injury Accidents] ON T_Departments.[Department Name] = [T_Personal Injury Accidents].Department

WHERE ((([T_Personal Injury Accidents].Department) Like "*" & [Forms]![F_Accident_by_AREA]![Dept_FormCombo] & "*") AND (([T_Personal Injury Accidents].[Date of Accident]) Between [Forms]![F_Accident_by_AREA]![Date_From] And [Forms]![F_Accident_by_AREA]![Date_To]));

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
.

__,_._,___

Tidak ada komentar:

Posting Komentar