I have the below code execute in a check box's "Click" event. Every time blnUserActive = True I receive the message pictured in attachment....How do I avoid this? I have tried putting the dirty check before and after the save record command...neither work.
Code:
Private Sub chkUserActive_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim blnUserActive As Boolean
Dim dtCurrDate As Date
Dim strUserID As String, mySQL As String
On Error GoTo ErrorHandler
Set db = CurrentDb
strUserID = txtUserID.Value
mySQL = "SELECT * FROM tblUsers WHERE [UserID] = '" & strUserID & "';"
Set rs = db.OpenRecordset(mySQL, dbOpenDynaset)
rs.MoveLast
rs.MoveFirst
dtCurrDate = Date
blnUserActive = chkUserActive.Value
If blnUserActive Then
rs.Edit
rs("UserInactiveDate").Value = dtCurrDate
rs.Update
If Me.Dirty Then Me.Dirty = False
RunCommand acCmdSaveRecord
Else
rs.Edit
rs("UserInactiveDate").Value = Null
rs.Update
RunCommand acCmdSaveRecord
End If
rs.Close
Exit Sub
ErrorHandler:
MsgBox "Critical Error!" & vbCrLf & vbCrLf & Err.Description, vbCritical, "Error # " & Err.Number
End Sub