What is the best way to pre-populate a new record form with a calculated value based on the previous record or a maximum value from all records? For example, when tracking automobile mileage, rather than starting from scratch with each new record, I would like to prefill the new odometer value with the previous odometer value plus the trip miles. Or, when generating invoice numbers, work order numbers, etc. I would prefill the new value with the maximum existing value plus one. I can't use an auto-incremement field for this because it is not the primary key, and MySQL only allows one per table.
Thanks,
Alan