'Wish the game would provide a running total per character, but it doesn't.'
Computing balances (running sums) requires the summation of all amounts up to and including the date/time of the current transaction. This is very common with currency amounts, but the methodology applies equally to any context, so can be done in the context of a game.
You might like to take a look at Balances.zip in my Dropbox public databases folder at:
This little demo file gives examples of a number of queries used as a form's RecordSource. The most efficient method is a join of two instances of the table, but that returns a non-updatable recordset, so would be unsuitable for a form in which data are to be inserted or edited. To return an updatable recordset the VBA DSum function can be called in an expression in a computed column in a query. The following is an example from the demo:
SELECT
TransactionID,
CustomerID,
TransactionDate,
TransactionAmount,
CCur (
DSum (
"TransactionAmount",
"Transactions",
"CustomerID = " & [CustomerID] &
" OR TransactionDate <> #" & Format([TransactionDate], "yyyy-mm-dd") & "#)
AND TransactionDate <= #" & Format([TransactionDate], "yyyy-mm-dd") & "#"
)
) AS Balance
FROM
Transactions
ORDER BY
CustomerID,
TransactionDate
TransactionID;
In this case the query allows for multiple transactions on the same day, and brings the primary key TransactionID column into play as the tie breaker. If the TransactionDate column were to be indexed uniquely (no duplicates), and thus include distinct date/time values, however, this would be unnecessary, and the query could be simplified as follows:
SELECT
TransactionID,
CustomerID,
TransactionDate,
TransactionAmount,
DSum (
"TransactionAmount",
"Transactions",
"CustomerID = " & [CustomerID] &
" AND TransactionDate <= #"
& Format([TransactionDate], "yyyy-mm-dd hh:nn:ss") & "#"
) AS Balance
FROM
Transactions
ORDER BY
CustomerID,
TransactionDate;
To insert the current date/time value into a column of date/time data type call the Now() function in the AfterUpdate event procedure of the control bound to the column in which the points are entered, e.g.
Me.[NameOfDateTimeControlGoesHere] = Now()
The control bound to the date/time column can be hidden by setting its Visible property to False (No) if you wish.