I have 4 queries each with the same amount of Ouput fields. 50k+ rows of data.
q1
SELECT tblWIP_History.PartNumber, tblWIP_History.UnfinishedSerialNumber, tblWIP_History.Location, tblWIP_History.Qty, tblWIP_History.UnitCost, tblWIP_History.ExtendedCost, Format([TransactionDate],"Short Date") AS StartDate, Format([IsMadeDateTime],"Short Date") AS EndDate, tblWIP_History.LongDescription
FROM tblWIP_History
WHERE (((Len(Format([TransactionDate],"Short Date")))>3) AND ((Len(Format([IsMadeDateTime],"Short Date")))>3));
q2
SELECT tblWIP.PartNumber, tblWIP.UnfinishedSerialNumber, tblWIP.Location, tblWIP.Qty, tblWIP.UnitCost, tblWIP.ExtendedCost, Format([TransactionDate],"Short Date") AS StartDate, Format(Now(),"Short Date") AS EndDate, tblWIP.LongDescription
FROM tblWIP;
q3
SELECT tblInventoryHistory.PartNumber, tblInventoryHistory.SerialNumber, tblInventoryHistory.Location, tblInventoryHistory.Qty, tblInventoryHistory.UnitTotalCost, tblInventoryHistory.ExtendedTotalCost, Format([TransactionDate],"Short Date") AS StartDate, Format([Ship_Date],"Short Date") AS EndDate, tblPartMaster.LongDescription
FROM tblInventoryHistory INNER JOIN tblPartMaster ON tblInventoryHistory.PartNumber = tblPartMaster.PartNumber
WHERE (((Len(Format([TransactionDate],"Short Date")))>1) AND ((Len(Format([Ship_Date],"Short Date")))>1) AND ((tblInventoryHistory.WasDeletedByAdj)=False));
q4
SELECT tblInventoryCurrent.PartNumber, tblInventoryCurrent.SerialNumber, tblInventoryCurrent.Location, tblInventoryCurrent.Qty, tblInventoryCurrent.UnitTotalCost, tblInventoryCurrent.ExtendedTotalCost, Format([TransactionDate],"Short Date") AS StartDate, Format(Now(),"Short Date") AS EndDate, tblPartMaster.LongDescription
FROM tblInventoryCurrent INNER JOIN tblPartMaster ON tblInventoryCurrent.PartNumber = tblPartMaster.PartNumber
WHERE (((Len(Format([TransactionDate],"Short Date")))>1) AND ((Len(Format(Now(),"Short Date")))>1));
From here I use query that says
SELECT * FROM q1
UNION
SELECT * FROM q2
UNION
SELECT * FROM q3
UNION
SELECT * FROM q4
When I run any of the queries as they are, data appears as I want. When I run q3, I do not get any rows that are "WasDeletedByAdj" = true. However when I run the Union Query I do get values where WasDeletedByAdj=True. Even though the query the data comes from, says dont.
I have tried Union All, didn't see anything different.
Thoughts?