How to retrieve the new ID during filling the form

Tiger955

Registered User.
Local time
Today, 18:08
Joined
Sep 13, 2013
Messages
140
Hi!

Access 2010 frontend, SQL-Server 2008 R2 backend

During filling a form, I generate a code which should include the ID of this record.

But the ID is not available before update of the form.

If I save the record before all fields mandatory are filled, i get an error of course.
How can I manage this and get the ID "earlier"?:confused:
Thanks
Michael
 
You could use an unbound form and on save, create the new record, get the ID and then update the record.
 
Two approaches. One, use the suggestion by Cronk above.

The other, if you can pre-compute the next ID number is to use Dmax and "add" whatever value (string) needs to be added and place it in a temporary field. When the form is saved, the new ID number will be generated and your temporary one will vaporize.

But a word caution, do not use the (record) ID number as the primary key. On my forms, the form has a unique ID, but it is not the primary key.
 
Last edited:
Thanks for the replies, I get my code number from DLast ...+1 and it works.

Regards
Michael
 

Users who are viewing this thread

Back
Top Bottom