jwcolby
jwcolby at colbyconsulting.com
Wed Apr 6 09:45:13 CDT 2011
LOL, boy howdy! How about this... Exit_mPLSLogin: On Error Resume Next rs.Close Set rs = Nothing Exit Function John W. Colby www.ColbyConsulting.com On 4/6/2011 10:38 AM, Jim Dettman wrote: > John, > > A little code cleanup: > > Exit_mPLSLogin: > On Error Resume Next > Set rs = Nothing > If Not (rs Is Nothing) Then rs.Close: Set rs = Nothing > Exit Function > > Should be: > > Exit_mPLSLogin: > On Error Resume Next > > If Not (rs Is Nothing) Then > rs.Close > Set rs = Nothing > End If > > Exit Function > > Jim. > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby > Sent: Wednesday, April 06, 2011 10:07 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Autonumber when? > > 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?