The following code is blowing up on the Myset.Master_Flag sentence - VBA is actually highlighting the Master_Flag which is a field in the recordset it is referring to. I'm using DAO 3.6 in the reference field. How do I fix it?
Dim MyDB As DAO.Database, Myset As DAO.Recordset
Dim Response As Integer
Dim criteria As String
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set Myset = MyDB.OpenRecordset("tblPassword", dbOpenDynaset)
criteria = "Password = '" & UCase(Forms![fmnuMainMenu]![txtPassword]) & "'"
' Verify that the password is on file and also that the user to authorized
' to change passwords
Myset.FindFirst criteria
If Myset.NoMatch Then
MsgBox "Invalid Password, Please try again!"
Forms![fmnuMainMenu].txtPassword = ""
Forms![fmnuMainMenu].txtPassword.SetFocus
Else
If Myset.Master_Flag = "Y" Then
Forms![fmnuMainMenu].txtPassword = ""
DoCmd.OpenForm "frmPasswordMaintenance"
Else
MsgBox "You are not authorized to change Passwords!"
Forms![fmnuMainMenu].txtPassword = ""
' Forms![fmnuMainMenu].ClickCase.SetFocus
End If
End If
End Sub
Thanks,
Sillygal![[ponytails] [ponytails] [ponytails]](/data/assets/smilies/ponytails.gif)
Dim MyDB As DAO.Database, Myset As DAO.Recordset
Dim Response As Integer
Dim criteria As String
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set Myset = MyDB.OpenRecordset("tblPassword", dbOpenDynaset)
criteria = "Password = '" & UCase(Forms![fmnuMainMenu]![txtPassword]) & "'"
' Verify that the password is on file and also that the user to authorized
' to change passwords
Myset.FindFirst criteria
If Myset.NoMatch Then
MsgBox "Invalid Password, Please try again!"
Forms![fmnuMainMenu].txtPassword = ""
Forms![fmnuMainMenu].txtPassword.SetFocus
Else
If Myset.Master_Flag = "Y" Then
Forms![fmnuMainMenu].txtPassword = ""
DoCmd.OpenForm "frmPasswordMaintenance"
Else
MsgBox "You are not authorized to change Passwords!"
Forms![fmnuMainMenu].txtPassword = ""
' Forms![fmnuMainMenu].ClickCase.SetFocus
End If
End If
End Sub
Thanks,
Sillygal
![[ponytails] [ponytails] [ponytails]](/data/assets/smilies/ponytails.gif)