identity column in .adp

J

Justin

On my form the record source is a table where the primary key is an autonumber.
I fill in the other fields and as expected the autonumber field still shows
the text "autonumber". What should I do to "retrieve" the number. without
having to close the form or move to a new record or press a button. The user
is supposed to continue filling bits on a subform which is related to it's
parent through the primary key.
Thanks in advance.
ps. this is my first adp project, after having programmed many .mdb, I did
have a look around the forum but did not see a similar question.(in the time
allocated)
 
S

Sylvain Lafontaine

The new autonumber will be retrieved when Access will make its first round
trip to the SQL-Server. Normally, this should happen automatically when the
focus leave the main form and go to the subform but if necessary, you can
force it with the following piece of code in the AfterUpdate event of one of
the controls on the main form:

If (Me.NewRecord) Then
DoCmd.RunCommand acCmdSaveRecord
End If
 
T

Tom

Autonumber works for mdb's only. In SQL server you make the column an
identity column. It will not allow nulls. You have more flexibility because
you can choose column type and it then takes identity seed and identity
increment.
 
Top