I have 3 tables
tblAccountNumbers
tblAccountValues
tblAccountFees
I need to build a query that pulls the account value for each account number and pull the correct % Fee. The account fee that is getting pulled in from tblAccountFees should be the fee that has an effective date that is <= to the Date selected in the form that runs the query, If there are multiple Fees that fit this criteria then it should pick the one with the largest value in the DateEntered Column.
The query should only have 1 row for each account. If you run the query for 3/31/20 you should get the following results
I've tried multiple scenarios and cant get anything to work. I think I'm going to need a sub query but cant figure out where to start. I've attached a sample db.
Andy
tblAccountNumbers
tblAccountValues
tblAccountFees
I need to build a query that pulls the account value for each account number and pull the correct % Fee. The account fee that is getting pulled in from tblAccountFees should be the fee that has an effective date that is <= to the Date selected in the form that runs the query, If there are multiple Fees that fit this criteria then it should pick the one with the largest value in the DateEntered Column.
The query should only have 1 row for each account. If you run the query for 3/31/20 you should get the following results
AccountNumber | AccountValue | ValueDate | FeePercent | FeeEffectiveDate | DateEntered |
Acct1 | $100 | 3/31/2020 | 1.10% | 2/28/2020 | 4/19/2021 |
Acct2 | $200 | 3/31/2020 | 2.00% | 12/31/2019 | 12/31/19 |
Acct3 | $300 | 3/31/2020 | 3.00% | 12/31/2019 | 12/31/19 |
Acct4 | $400 | 3/31/2020 | 4.00% | 12/31/2019 | 12/31/19 |
I've tried multiple scenarios and cant get anything to work. I think I'm going to need a sub query but cant figure out where to start. I've attached a sample db.
Andy