I wasn't quite sure how to phrase this question as it may not be possible to do in Access (with my limited knowledge and extensive study of Query and Table Relationships). Unfortunately I can't show screenshots because of sensitive data but I will do my best to express it with characters.
I am trying to combine two simple queries that only pull merchants who are out of a certain date range (overdue for certification). Merchants can be overdue for scans and their SAQ. I can easily make two separate queries for each one but I am wondering if its possible to run one query that will include both.
Example of what I have:
Merchant Account | DBA Name | ECM Name | SAQ Due Date
000000000000000....XXXX........... XXXX........... 10/10/2013
Merchant Account | DBA Name | ECM Name | SCAN Due Date
111111111111111111..ZZZZ.............ZZZZ.............1/12/2012
I have accomplished the above by setting Between Date() and Date()-1000 criteria parameters on a Simple Query. My goal is to produce the below;
Merchant Account | DBA Name | ECM Name | SCAN Due Date | SAQ Due Date
111111111111111111..ZZZZ.............ZZZZ.............1/12/2012.............NULL/NO DATA
0000000000000000..XXXX........... XXXX........... NULL/NO DATA.....10/10/2013
Honestly it may just be easier to export both queries and manually copy/paste the column but I wasn't sure if it was possible to accomplish it with less steps! :-]
Goals:
- Pull 2 queries from a table that has both Scan and SAQ columns
- Pull overdue dates starting from the current date
- Refrain from overlapping data, effectively adding information instead of combining
Things that I have tried:
- Union Query
- Join Query
- Experimenting with Parameters
Thank you!
EDIT
SELECT [Overall Status Report].[Merchant Account Number], [Overall Status Report].[DBA Name], [Overall Status Report].[PCI Contact Name], [Overall Status Report].[PCI Contact Number], [Overall Status Report].[Email address], [Overall Status Report].[ECM Name], [Overall Status Report].[ECM Email], [Overall Status Report].[SAQ Due Date]
FROM [Overall Status Report]
WHERE ((Not ([Overall Status Report].[ECM Name])="ACCOUNT CLOSED") AND (([Overall Status Report].[SAQ Due Date]) Between Date() And Date()-1000))
UNION
SELECT [Overall Status Report].[Merchant Account Number], [Overall Status Report].[DBA Name], [Overall Status Report].[PCI Contact Name], [Overall Status Report].[PCI Contact Number], [Overall Status Report].[Email address], [Overall Status Report].[ECM Name], [Overall Status Report].[ECM Email], [Overall Status Report].[Scan Due Date]
FROM [Overall Status Report]
WHERE ((Not ([Overall Status Report].[ECM Name])="ACCOUNT CLOSED") AND (([Overall Status Report].[Scan Due Date]) Between Date() And Date()-1000));
This works great but it does not separate the SAQ data and the SCAN data into two separate columns, making it difficult to know which one the merchant is overdue on.
EDIT 2:
SELECT [Overall Status Report].[Merchant Account Number], [Overall Status Report].[DBA Name], [Overall Status Report].[PCI Contact Name], [Overall Status Report].[PCI Contact Number], [Overall Status Report].[Email address], [Overall Status Report].[ECM Name], [Overall Status Report].[ECM Email], NULL AS [Overall Status Report].[SAQ Due Date], [Overall Status Report].[Scan Due Date]
FROM [Overall Status Report]
WHERE ((([Overall Status Report].[ECM Name])<>"ACCOUNT CLOSED") AND (([Overall Status Report].[SAQ Due Date]) Between Date() And Date()-1000) AND (([Overall Status Report].[Scan Due Date]) Between Date() And Date()-1000))
UNION
SELECT [Overall Status Report].[Merchant Account Number], [Overall Status Report].[DBA Name], [Overall Status Report].[PCI Contact Name], [Overall Status Report].[PCI Contact Number], [Overall Status Report].[Email address], [Overall Status Report].[ECM Name], [Overall Status Report].[ECM Email], [Overall Status Report].[SAQ Due Date], NULL AS [Overall Status Report].[Scan Due Date]
FROM [Overall Status Report]
WHERE ((([Overall Status Report].[ECM Name])<>"ACCOUNT CLOSED") AND (([Overall Status Report].[SAQ Due Date]) Between Date() And Date()-1000) AND (([Overall Status Report].[Scan Due Date]) Between Date() And Date()-1000));