Query with two different Criteria,

Hollar

New member
Local time
Today, 10:33
Joined
Apr 30, 2012
Messages
9
Here is the short overview of my dilemma. I have a query against two tables based on the [Due Date]. When the query is called it presents two dialogue boxes with the “Start Date” and the “End Date”. What I would like to include in the results is any part number in [Status] that was “completed” within the time specified in the query, whether its start or end date falls within the initial entry date range. I turned my query into a SQL statement and included it as a txt document. See what you all think . . . .
Hollar
 

Attachments

This is how you post your code
Code:
SELECT DISTINCTROW [Label Insert].ID, [Label Insert].[P/N REV], [Label Insert].Description, [Label Insert].[Doc Type], [Label Insert].[Assigned To], [Label Insert].[Assigned Date], [Label Insert].[Due Date], [Label Insert].Status, [Label Insert].Comments, [Label Insert].Requester, [Label Insert].C_O_, [Label Insert].Priority, [Label Insert].[Cost Center], [Label Insert].Hours, [Label Insert].[Dev Center], [Label Insert].Translations, [Label Insert].[Out for Approval Date], [Label Insert].[Complete Date], [Label Insert]![Due Date]-[Label Insert]![Assigned Date] AS [Order Entry & Production - Cycle Time], [Label Insert]![Out for Approval Date]-[Label Insert]![Due Date] AS [Review Gate - Actual vs Deadline], [Label Insert]![Complete Date]-[Label Insert]![Due Date] AS [Review/Approval - Phoenix Process], [Label Insert]![Complete Date]-[Label Insert]![Assigned Date] AS [Order Entry to Release Cycle Time - Total], [Label Insert].[P/N REV], [Label Insert].[P/N REV], [Label Insert Error Tbl 1].[Rejection Code 1], [Label Insert Error Tbl 1].[Rejection Date 1], [Label Insert Error Tbl 1].[Add 1], [Label Insert Error Tbl 1].[Rejection Code 2], [Label Insert Error Tbl 1].[Rejection Date 2], [Label Insert Error Tbl 1].[Add 2], [Label Insert Error Tbl 1].[Rejection Code 3], [Label Insert Error Tbl 1].[Rejection Date 3], [Label Insert Error Tbl 1].[Add 3], [Label Insert Error Tbl 1].[Rejection Code 4], [Label Insert Error Tbl 1].[Rejection Date 4], [Label Insert Error Tbl 1].[Add 4], [Label Insert Error Tbl 1].[Rejection Code 5], [Label Insert Error Tbl 1].[Rejection Date 5], [Label Insert Error Tbl 1].[Add 5], [Label Insert Error Tbl 1].Totals
FROM [Label Insert Error Tbl 1] RIGHT JOIN [Label Insert] ON [Label Insert Error Tbl 1].[P/N Rev] = [Label Insert].[P/N REV]
GROUP BY [Label Insert].ID, [Label Insert].Description, [Label Insert].[Doc Type], [Label Insert].[Assigned To], [Label Insert].[Assigned Date], [Label Insert].[Due Date], [Label Insert].Status, [Label Insert].Comments, [Label Insert].Requester, [Label Insert].C_O_, [Label Insert].Priority, [Label Insert].[Cost Center], [Label Insert].Hours, [Label Insert].[Dev Center], [Label Insert].Translations, [Label Insert].[Out for Approval Date], [Label Insert].[Complete Date], [Label Insert].[P/N REV], [Label Insert Error Tbl 1].[Rejection Code 1], [Label Insert Error Tbl 1].[Rejection Date 1], [Label Insert Error Tbl 1].[Add 1], [Label Insert Error Tbl 1].[Rejection Code 2], [Label Insert Error Tbl 1].[Rejection Date 2], [Label Insert Error Tbl 1].[Add 2], [Label Insert Error Tbl 1].[Rejection Code 3], [Label Insert Error Tbl 1].[Rejection Date 3], [Label Insert Error Tbl 1].[Add 3], [Label Insert Error Tbl 1].[Rejection Code 4], [Label Insert Error Tbl 1].[Rejection Date 4], [Label Insert Error Tbl 1].[Add 4], [Label Insert Error Tbl 1].[Rejection Code 5], [Label Insert Error Tbl 1].[Rejection Date 5], [Label Insert Error Tbl 1].[Add 5], [Label Insert Error Tbl 1].Totals
HAVING ((([Label Insert].[Due Date]) Between [Due Date Start date] And [Due Date End date]))
ORDER BY [Label Insert].[Due Date];
 
Common advice is to avoid spaces in table and field names.
Also, special charaters eg [P/N REV] is not a recommended field name.
 

Users who are viewing this thread

Back
Top Bottom