[AccessD] Autonumber when?

jwcolby jwcolby at colbyconsulting.com
Wed Apr 6 09:06:59 CDT 2011


Rusty,

The following is the actual code.

'
'Adds a record to the table saying that a specific user logged in at a specific time
'
'*+ Private class functions
Private Function mPLSLogin(blnLogIn As Boolean)
Dim rs As DAO.Recordset
Dim db As DAO.Database

On Error GoTo Err_mPLSLogin

     Set db = dbDAOCurr
     Set rs = db.OpenRecordset("usystblPLSLog", dbOpenDynaset, dbSeeChanges)
     If mlngIDUser = 0 Then Exit Function
     With rs
         .AddNew
         !PLSL_IDPLSUSR = mlngIDUser
         !PLSL_FE = CurrentProject.Name
         !PLSL_Login = blnLogIn
         !PLSL_WorkstationID = CurrentMachineName()
         On Error Resume Next
         mlngLogID = !PLSL_ID
         .Update
         If Err Then
             mlngLogID = !PLSL_ID
         End If

         .Close
     End With

Exit_mPLSLogin:
     On Error Resume Next
     Set rs = Nothing
     If Not (rs Is Nothing) Then rs.Close: Set rs = Nothing
     Exit Function
Err_mPLSLogin:
     Select Case Err
     Case 0      '.insert Errors you wish to ignore here
         Resume Next
     Case Else   '.All other errors will trap
         Beep
         PLSLogErr Err.Number, Err.Description, Erl, cstrModule, "mPLSLogin"
         Resume Exit_mPLSLogin
     End Select
     Resume 0    '.FOR TROUBLESHOOTING
End Function


John W. Colby
www.ColbyConsulting.com

On 4/6/2011 9:47 AM, Rusty Hammond wrote:
> When you set your recordset are you using the dbSeeChanges option?



More information about the AccessD mailing list