Originally Posted by
June7
Is it a certainty that the BILLMOYR value will be sequential, no gaps, so that -1 will always work (exception would be the very first record for each account).
If all you want is the value to show up on a form for the current record, a DLookup() in textbox ControlSource could accomplish that.
DLookup("ReadDate", "MBRHISTDETL", "BILLMOYR=" & Me.tbxBILLMOYR - 1)
I believe this is similar to the query inside of a query. 2 queries have already been built to just produce the last payment amount and date. I am worried that by the time I am through getting the 12 fields I need from only 2 tables I will have 10 querries stacked or linked together. That would make for a troubleshooting nightmare would it not?
But domain aggregate functions can be slow performers in textbox and in queries. So if you want this output in a report, the query method is best.
Another query approach is to build query that calculates a field for the user input value.
SELECT *, BILLMOYR + 1 AS MatchMOYR FROM MBRHISTDETL;
Now build another query that joins the original dataset to this query by linking on BILLMOYR and MatchMOYR fields. Could try this second query as the form's RecordSource. I am wondering if the query will be not editable for the fields from the original dataset.