How can I set a default value in a numeric field in a form based on what’s already in the database? E.g. last entered document number was 12, so I want to have 13 as the default value in a numeric field when creating new record.
Another version of the same question: can I use SQL query to set a default value of a numeric field?
The only way I could do it is with a macro, but is there a simpler way?
The full story:
I’m designing a small document handling database. Documents for a given year have consecutive numbers (2021/1, 2021/2 etc). When creating a new record I want to set the current document number based on the largest number found in the database for the given year, so if the database has 2 documents for 2021 I want to have 3 as the default value for the document number. I use numeric fields for year and document numbers.
P.S. The question is about Base
Edit:
I use the HSQLDB embedded