I wrote this query to do the following:
1) Check a date range
2) Check a Value Stream
3) Return all records in that date range that have that Value Stream as a Sender or a Receiver
The following is the SQL and I'm also attaching an image of what the relationships look like. I'm currently getting zero returns from this query and I should get 232. Thanks in advance!
Code:
SELECT QA.[QA Number], QA.[QA Type], QA.[QA Trigger], QA.[Discovered On], QA.Shift, QA.[Date Produced], QA.[Lot Number or Cavity Number], QA.[RBS Die Number or Mold Letter], QA.[Details from Issuer], QA.[Immediate Actions Taken], QA.[Scrapped Material?], QA.[Qty and Amt], QA.[Traceability Data], QA.[Is this a HOLD?], QA.[BAM Cut-Off Die Number], QA.[Area Where Discovered], QA.[Receiving Area], QA.[Machine ID], QA.[Product Being Rejected], QA.[Discovered By], QA.[Technician Addressing QA]
FROM (Areas INNER JOIN QA ON Areas.[Area ID] = QA.[Area Where Discovered]) INNER JOIN Areas AS Areas_1 ON QA.[Receiving Area] = Areas_1.[Area ID]
WHERE (
(
(QA.[Discovered On]) Between [Forms]![Export QAs to Excel]![Text45] And [Forms]![Export QAs to Excel]![Text47]
)
AND
(
(Areas.[Value Stream]) Like "*" & Forms![Export QAs to Excel]!VsSelect & "*" OR (Areas_1.[Value Stream]) Like "*" & Forms![Export QAs to Excel]!VsSelect & "*"
)
)