I am using qryRMonthlyGainSum4GainLoss (below) to obtain the Actual Balance as follows:
ActualBal: Nz(([Total]+[AirGainLossNZ]),0)
Another value for gain/loss, called AirGainLossNZ, is calculated in a separate query as shown below in qryRGainLoss15Report.
Somehow I need to reset the value for AirGainLossNZ after the last day of each month so the first day of each month has a gain/loss value of 0.
How would I go about doing this? Is it possible to keep the previous values in case the report needs re-run for a previous month?
qryRMonthlyGainSum4GainLoss
qryRGainLoss15Report
Here is a sample report:
ActualBal: Nz(([Total]+[AirGainLossNZ]),0)
Another value for gain/loss, called AirGainLossNZ, is calculated in a separate query as shown below in qryRGainLoss15Report.
Somehow I need to reset the value for AirGainLossNZ after the last day of each month so the first day of each month has a gain/loss value of 0.
How would I go about doing this? Is it possible to keep the previous values in case the report needs re-run for a previous month?
qryRMonthlyGainSum4GainLoss
SELECT qryRMonthlySumTrans2.TransactionID, qryRMonthlySumTrans2.TransactionDate, qryRMonthlySumTrans2.AirlineCompanyLookup, qryRMonthlySumTrans2.BegBalance, qryRMonthlySumTrans2.GallonsRcvd, qryRMonthlySumTrans2.GallonsIssd, qryRMonthlySumTrans2.Total, qryRMonthlySumTrans4GainLoss.AirGainLossNz, Nz(([Total]+[AirGainLossNZ]),0) AS ActualBal
FROM qryRMonthlySumTrans2 LEFT JOIN qryRMonthlySumTrans4GainLoss ON qryRMonthlySumTrans2.AirlineCompanyLookup = qryRMonthlySumTrans4GainLoss.AirlineCompanyLookup
WHERE (((qryRMonthlySumTrans2.TransactionDate) Between [TempVars]![tmpStartDate] And [TempVars]![tmpEndDate]))
GROUP BY qryRMonthlySumTrans2.TransactionID, qryRMonthlySumTrans2.TransactionDate, qryRMonthlySumTrans2.AirlineCompanyLookup, qryRMonthlySumTrans2.BegBalance, qryRMonthlySumTrans2.GallonsRcvd, qryRMonthlySumTrans2.GallonsIssd, qryRMonthlySumTrans2.Total, qryRMonthlySumTrans4GainLoss.AirGainLossNz;
qryRGainLoss15Report
SELECT qryRGainLoss13TotIssued.AirlineCompanyLookup, qryRGainLoss13TotIssued.LastOfRunIss, Last(FormatPercent((([LastOfRunIss])/([MaxOfTotalIss])))) AS PercentUsed, qryRGainLoss12ActualBalanceTotGainLoss.TotGainLoss, Round((([LastOfRunIss]/[MaxOfTotalIss])*[TotGainLoss]),2) AS AirGainLoss, qryRGainLoss14MaxTotIssued.MaxOfTotalIss, ([TotGainLoss]/[MaxOfTotalIss]) AS GainLossPcnt, (Last([LastOfRunIss])/([MaxOfTotalIss])) AS UsedNumeric
FROM qryRGainLoss14MaxTotIssued, qryRGainLoss12ActualBalanceTotGainLoss, qryRGainLoss13TotIssued
GROUP BY qryRGainLoss13TotIssued.AirlineCompanyLookup, qryRGainLoss13TotIssued.LastOfRunIss, qryRGainLoss12ActualBalanceTotGainLoss.TotGainLoss, qryRGainLoss14MaxTotIssued.MaxOfTotalIss;
Here is a sample report: