OK- here we go.
I made slight alterations to the code for keytest to produce the following key 006951838102000025, being one of the first ones.
The key wording is................... keytest: (Format([HistoryID],"00000") & Format([InvoiceDate],"yyyymmdd") & Format([ID],"000000"))
This gives me the data sorted by Job, then Date, then ID in case there are two or more entries with the same date.
I've left it as text because it went to an exponential if turned into a number.
So now to the TrialBal
I've tried various permutations of the criteria wording, but it wont play so I've left it at what you wrote. I still don't understand the syntax underpinning it, though.
BalTrial: CCur(DSum("[CalcTodaysValue]","BillsIssuedAndPaidQuery","keytest<='" & keytest & "'"))
Thanks
Mike