Gustav Brock
Gustav at cactus.dk
Sun Apr 1 07:30:04 CDT 2007
Hi John That depends, but I guess you need the classic function (session scope) of @@IDENTITY. Here's an explanation: http://www.sqlteam.com/item.asp?ItemID=319 /gustav >>> jwcolby at colbyconsulting.com 01-04-2007 14:13 >>> 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