I made it work by adding the highlighted part in the code below, although it doesn't make sense since this code runs on Form Load....(the code is part of what I have on frmMain...remaining code deals with opening other forms etc.)
Option Compare Database
Private intLogonAttempts As Integer
Private Sub Form_Load()
Me.Visible = True
On Error Resume Next
Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim myQuery As String
Dim i As Integer
myQuery = "SELECT * FROM RATusers WHERE NetworkID = '" & Environ("UserName") & "'"
Set db = CurrentDb()
Set rst = db.OpenRecordset(myQuery, dbOpenDynaset, dbSeeChanges)
If Not rst.BOF And Not rst.EOF Then
rst.Edit
rst.Fields("LogonCount") = rst.Fields("LogonCount") + 1
rst.Fields("LastLogon") = Now()
rst.Update
Me.txtSecurityID = rst.Fields("SecurityID")
If Me.txtSecurityID <> 3 Then
DoCmd.NavigateTo "acNavigationCategoryObjectType"
DoCmd.RunCommand acCmdWindowHide
'For i = 1 To CommandBars.Count
'CommandBars(i).Enabled = False
'Next i
DoCmd.ShowToolbar "Ribbon", acToolbarNo
End If
Me.txtUserID = rst.Fields("UserID")
Me.txtOverride = rst.Fields("SpecialPermissions")
Me.txtPassword = rst.Fields("Password")
DoEvents
Else
DoCmd.NavigateTo "acNavigationCategoryObjectType"
DoCmd.RunCommand acCmdWindowHide
'For i = 1 To CommandBars.Count
'CommandBars(i).Enabled = False
'Next i
DoCmd.ShowToolbar "Ribbon", acToolbarNo
Me.Dirty = False
Me.Visible = False
DoCmd.OpenForm "frmNewUser", acNormal, , , , acDialog
Do Until Me.Tag = "Continue"
DoEvents
Loop
Me.Visible = True
Me.txtSecurityID = rst.Fields("SecurityID")
Me.txtUserID = rst.Fields("UserID")
Me.txtOverride = rst.Fields("SpecialPermissions")
Me.txtPassword = rst.Fields("Password")
DoEvents
End If
If Me.txtSecurityID <> 3 Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
Set rst = Nothing
db.Close
Set db = Nothing
If IsDeveloper Then
ChangeProperty "AllowBypassKey", dbBoolean, True
Else
ChangeProperty "AllowBypassKey", dbBoolean, False
End If
Form_Load_Exit:
Exit Sub:
End Sub