Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Forecast autofield value in Base form

For my database I created a form with "Add data only" property to insert new records in a table.
Every record has a unique "ID".
The ID field generally displays <AutoField> until the record is saved, after that the ID number is generated and displayed in his form field.

I'd like to display this new ID number just when the form is opened, before the record is saved.

So I created a Query SELECT COUNT( * ) + 1 "NewID" FROM "Items" (I know this is not really the AutoField value, but could be enough for my project).
I added a subform with the Query as Content.
And into the subform added a new ID field with "NewID" assigned as Data field.

This partially works: when the form is opened the ID field is 1, and it's updated to the total number of records after the record is saved...

Is it possible to "refresh" the ID field just after the form is opened? So that it immediately shows the total number of records + 1.
Should I use a macro?

I found this topic asking the same but not really solving the problem.

Thank you!