First off, apologies as this is my 3rd attempt at getting this report right. Please allow me to start fresh here:
I now have the following queries:
qryRMonthlySum2_DailyBal - uses data from qryRMonthlySum3_Compare to obtain daily transaction balance (DailyBal) for each airline. The DailyBal is used to formulate expressions
qryRMonthlySum3_Compare - used to get previous day
qryRMonthlySum4_GainLoss - pulls gain/loss value from table
qryRMonthlySum5_Summary - calculate's current Actual Balance as follows:
The final product will require the user to enter an ending date inside a form, typically the last day of the month.
This query/report will display all columns from qryRMonthlySum5_Summary where qryRMonthlySum2_DailyBal.TransactionDate is the end date entered in the form. However, The DailyBal in the final query/report will need to be the previous month's ActualBal. (The DailyBal of each month will be the previous month's ActualBal)
How do I go about making this happen?
I now have the following queries:
qryRMonthlySum2_DailyBal - uses data from qryRMonthlySum3_Compare to obtain daily transaction balance (DailyBal) for each airline. The DailyBal is used to formulate expressions
qryRMonthlySum3_Compare - used to get previous day
qryRMonthlySum4_GainLoss - pulls gain/loss value from table
qryRMonthlySum5_Summary - calculate's current Actual Balance as follows:
SELECT qryRMonthlySum2_DailyBal.TransactionDate, qryRMonthlySum2_DailyBal.AirlineCompanyLookup, qryRMonthlySum2_DailyBal.DailyBal, qryRMonthlySum2_DailyBal.GallonsRcvd, qryRMonthlySum2_DailyBal.GallonsIssd, qryRMonthlySum2_DailyBal.Total, qryRMonthlySum4_GainLoss.AirGainLossNz, [B]Nz(([Total]+[AirGainLossNZ]),0) AS ActualBal[/B]
FROM qryRMonthlySum2_DailyBal LEFT JOIN qryRMonthlySum4_GainLoss ON (qryRMonthlySum2_DailyBal.TransactionDate = qryRMonthlySum4_GainLoss.MaxOfTransactionDate) AND (qryRMonthlySum2_DailyBal.AirlineCompanyLookup = qryRMonthlySum4_GainLoss.AirlineCompanyLookup)
GROUP BY qryRMonthlySum2_DailyBal.TransactionDate, qryRMonthlySum2_DailyBal.AirlineCompanyLookup, qryRMonthlySum2_DailyBal.DailyBal, qryRMonthlySum2_DailyBal.GallonsRcvd, qryRMonthlySum2_DailyBal.GallonsIssd, qryRMonthlySum2_DailyBal.Total, qryRMonthlySum4_GainLoss.AirGainLossNz
ORDER BY qryRMonthlySum2_DailyBal.TransactionDate DESC , qryRMonthlySum2_DailyBal.AirlineCompanyLookup;
The final product will require the user to enter an ending date inside a form, typically the last day of the month.
This query/report will display all columns from qryRMonthlySum5_Summary where qryRMonthlySum2_DailyBal.TransactionDate is the end date entered in the form. However, The DailyBal in the final query/report will need to be the previous month's ActualBal. (The DailyBal of each month will be the previous month's ActualBal)
How do I go about making this happen?