I am in need of some expertise.
I have have read through the R/T error 2467 threads but none seem to deal with my particular problem (apart from the suggestion that it could be a bug in Access 2010)
To keep it simple, I have created a Navigation form with the Login built into the header. For cosmetic reasons, I want the navigation menus hidden until the user has logged in. The code (that is adapted from Austin72406 (YouTube ref)) works up until the If Then Else that actually makes the menus visible. At that point, it puts up the R/T 2467 error and I just can't understand why.
I have run the make visible code from a separate cmd button in the header and it works fine. Integrate that into the cmdLogin_Click() sub and it fails. And I am banging my head against the wall trying to work out why. :banghead:
The code is below. Can someone spot the error, please, because I'm blowed if I can.
There are more lines of VBA but the code falters at that line and no matter what alternative I use (I have created this form twice which makes me think I have a problem elsewhere) I cannot crack it.
All help is greatly appreciated.
I have have read through the R/T error 2467 threads but none seem to deal with my particular problem (apart from the suggestion that it could be a bug in Access 2010)
To keep it simple, I have created a Navigation form with the Login built into the header. For cosmetic reasons, I want the navigation menus hidden until the user has logged in. The code (that is adapted from Austin72406 (YouTube ref)) works up until the If Then Else that actually makes the menus visible. At that point, it puts up the R/T 2467 error and I just can't understand why.
I have run the make visible code from a separate cmd button in the header and it works fine. Integrate that into the cmdLogin_Click() sub and it fails. And I am banging my head against the wall trying to work out why. :banghead:
The code is below. Can someone spot the error, please, because I'm blowed if I can.
Code:
Dim SecurityID As Integer
Dim TempPass As String
Dim ID As Integer
If IsNull(Me.txtUserName) Then
Msgbox "Please enter your UserName", vbInformation, "UserName Required"
Me.txtUserName.SetFocus
ElseIf IsNull(Me.Password) Then
Msgbox "Please enter your Password", vbInformation, "Password Required"
Me.txtPassword.SetFocus
Else
If (IsNull(DLookup("[UserName]", "tblUser", "[UserName] = '" &
Me.txtUserName.Value & "' And Password = '" & Me.txtUserName.Value &
"'"))) Then
Msgbox "Incorrect UserName or Password"
Else
SecurityID = Dlookup("SecurityID", "tblUser", "UserName = '" &
Me.txtUserName.Value & "'")
TempPass = Dlookup("Password", "tblUser", "UserName = '" &
Me.txtUserName.Value & "'")
ID = Dlookup("UserID", "tblUser", "UserName = '" &
Me.txtUserName.Value & "'")
DoCmd.Close
If (TempPass = "Password") Then
Msgbox "Please change your Password.", vbInformation, "New Password Required!"
DoCmd.OpenForm "User Updater",,,"[UserID] = " & ID
Else
'R/T error 2467 starts here
If SecurityID = 1 Then '1=Admin, 2=User
Me!NavigationControl05.Visible = True
There are more lines of VBA but the code falters at that line and no matter what alternative I use (I have created this form twice which makes me think I have a problem elsewhere) I cannot crack it.
All help is greatly appreciated.