[AccessD] SQL Server table autonumber

John Colby jwcolby at ColbyConsulting.com
Thu Dec 22 07:04:37 CST 2005


In Access (Jet, MDB BE) when I create a new record in a table with an
autonumber, 

        .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

I grab the new PK before doing the update.  When ported to SQL Server the
!LWSL_ID in the next to the last line is null.  How do I grab the PKID from
a new record when using SQL Server as the BE?

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/




More information about the AccessD mailing list