I have two queries and give me a result for each that I want to subtract. In the SQL world, this is not as easy as it sounds. I am about the drive myself insane.
And the info. that I have found on the internet has been no help.
Here are the two queries-
TotalEDCalled=
SELECT Month([CodeStrokeDate]) & "/" & Year([CodeStrokeDate]) AS [Month/Year], Count(tblCodeStrokePts.CodeStrokeDate) AS [Total ED Called]
FROM tblCodeStrokePts
WHERE (((tblCodeStrokePts.CodeStrokeDate) Between [Forms]![frmQuerySwitchboard]![txtStartdate] And [Forms]![frmQuerySwitchboard]![txtEnddate]))
GROUP BY Month([CodeStrokeDate]) & "/" & Year([CodeStrokeDate]), Year([CodeStrokeDate]), Month([CodeStrokeDate]), tblCodeStrokePts.InHouseCS, tblCodeStrokePts.IVtPADripAndShip
HAVING (((tblCodeStrokePts.InHouseCS)="No" Or (tblCodeStrokePts.InHouseCS) Is Null Or (tblCodeStrokePts.InHouseCS)="N") AND ((tblCodeStrokePts.IVtPADripAndShip)="No" Or (tblCodeStrokePts.IVtPADripAndShip) Is Null Or (tblCodeStrokePts.IVtPADripAndShip)="N"))
ORDER BY Year([CodeStrokeDate]), Month([CodeStrokeDate]);
And
TotalEDCanceled=
SELECT Month([CodeStrokeDate]) & "/" & Year([CodeStrokeDate]) AS [Month/Year], Count(tblCodeStrokePts.CodeStrokeDate) AS [Total ED Canceled]
FROM tblCodeStrokePts
WHERE (((tblCodeStrokePts.Canceled)="Y") AND ((tblCodeStrokePts.CodeStrokeDate) Between [Forms]![frmQuerySwitchboard]![txtStartdate] And [Forms]![frmQuerySwitchboard]![txtEnddate]))
GROUP BY Month([CodeStrokeDate]) & "/" & Year([CodeStrokeDate]), Year([CodeStrokeDate]), Month([CodeStrokeDate]), tblCodeStrokePts.InHouseCS
HAVING (((tblCodeStrokePts.InHouseCS)="No" Or (tblCodeStrokePts.InHouseCS) Is Null Or (tblCodeStrokePts.InHouseCS)="N"))
ORDER BY Year([CodeStrokeDate]), Month([CodeStrokeDate]);
I want to subtract TotalEDCanceled from TotalEDCalled to give me TotalEDCompleted.
I would greatly appreciate anyone's help. Thank you!
Here are the two queries-
TotalEDCalled=
SELECT Month([CodeStrokeDate]) & "/" & Year([CodeStrokeDate]) AS [Month/Year], Count(tblCodeStrokePts.CodeStrokeDate) AS [Total ED Called]
FROM tblCodeStrokePts
WHERE (((tblCodeStrokePts.CodeStrokeDate) Between [Forms]![frmQuerySwitchboard]![txtStartdate] And [Forms]![frmQuerySwitchboard]![txtEnddate]))
GROUP BY Month([CodeStrokeDate]) & "/" & Year([CodeStrokeDate]), Year([CodeStrokeDate]), Month([CodeStrokeDate]), tblCodeStrokePts.InHouseCS, tblCodeStrokePts.IVtPADripAndShip
HAVING (((tblCodeStrokePts.InHouseCS)="No" Or (tblCodeStrokePts.InHouseCS) Is Null Or (tblCodeStrokePts.InHouseCS)="N") AND ((tblCodeStrokePts.IVtPADripAndShip)="No" Or (tblCodeStrokePts.IVtPADripAndShip) Is Null Or (tblCodeStrokePts.IVtPADripAndShip)="N"))
ORDER BY Year([CodeStrokeDate]), Month([CodeStrokeDate]);
And
TotalEDCanceled=
SELECT Month([CodeStrokeDate]) & "/" & Year([CodeStrokeDate]) AS [Month/Year], Count(tblCodeStrokePts.CodeStrokeDate) AS [Total ED Canceled]
FROM tblCodeStrokePts
WHERE (((tblCodeStrokePts.Canceled)="Y") AND ((tblCodeStrokePts.CodeStrokeDate) Between [Forms]![frmQuerySwitchboard]![txtStartdate] And [Forms]![frmQuerySwitchboard]![txtEnddate]))
GROUP BY Month([CodeStrokeDate]) & "/" & Year([CodeStrokeDate]), Year([CodeStrokeDate]), Month([CodeStrokeDate]), tblCodeStrokePts.InHouseCS
HAVING (((tblCodeStrokePts.InHouseCS)="No" Or (tblCodeStrokePts.InHouseCS) Is Null Or (tblCodeStrokePts.InHouseCS)="N"))
ORDER BY Year([CodeStrokeDate]), Month([CodeStrokeDate]);
I want to subtract TotalEDCanceled from TotalEDCalled to give me TotalEDCompleted.
I would greatly appreciate anyone's help. Thank you!