JWColby
jwcolby at colbyconsulting.com
Sun Apr 1 07:13:16 CDT 2007
In an Access database the PKID (autonumber) of a table is available the
instant after doing the insert or AddNew, so I would use code such as:
With RS
.Open "usystbllwsLog", gcnn, adOpenKeyset, adLockPessimistic
'build a logout record.
.AddNew
!LWSL_IDLWSU = mlngUserID
!LWSL_FE = CurrentProject.name
!LWSL_Login = blnLogIn
!LWSL_WorkstationID = CurrentMachineName()
mlngLogID = !LWSL_ID
.Update
.Close
End With
the code line
mlngLogID = !LWSL_ID
fails when used in SQL Server because the ID is not yet valid. How do I
work around this when the table is out in SQL Server?
John W. Colby
Colby Consulting
www.ColbyConsulting.com