Dear All,
I am doing a login form for my database using online references and videos.
Below is the code for my login form.
Private Sub Form_Load()
Dim Security As Integer
Me.txtUser = Environ("USERNAME")
If IsNull(DLookup("UserSecurity", "Userslist_table", "[UserLogin]='" & Me.txtUser & "'")) Then
MsgBox "No Usersecurity set up for this user. please contact the Admin", vbOKOnly, "Login info"
Me.NavigationButton11.Enabled = False
Else
Security = DLookup("UserSecurity", "Userslist_table", "[Userlogin]='" & Me.txtUser & "'")
If Security = 1 Then
Me.NavigationButton11.Enabled = True
Else
Me.NavigationButton11.Enabled = False
End If
End If
End Sub
i am facing problem for run-time error type mismatch '13': i have listed below field names which is used in above coding.
UserSecurity_table
[SecurityID] is Autonumber field
[SecurityLevel] is Text field
Userlist_table
[UserID] is autonumber field
[Username] is text field
[Userlogin] is text field
[Usersecurity] is text field
[Password] is text field
Can you please help to sort this out.
regards,
MBA
I am doing a login form for my database using online references and videos.
Below is the code for my login form.
Code:
Dim Security As Integer
Me.txtUser = Environ("USERNAME")
If IsNull(DLookup("UserSecurity", "Userslist_table", "[UserLogin]='" & Me.txtUser & "'")) Then
MsgBox "No Usersecurity set up for this user. please contact the Admin", vbOKOnly, "Login info"
Me.NavigationButton11.Enabled = False
Else
Security = DLookup("UserSecurity", "Userslist_table", "[Userlogin]='" & Me.txtUser & "'")
If Security = 1 Then
Me.NavigationButton11.Enabled = True
Else
Me.NavigationButton11.Enabled = False
End If
End If
End Sub
Code:
i am facing problem for run-time error type mismatch '13': i have listed below field names which is used in above coding.
UserSecurity_table
[SecurityID] is Autonumber field
[SecurityLevel] is Text field
Userlist_table
[UserID] is autonumber field
[Username] is text field
[Userlogin] is text field
[Usersecurity] is text field
[Password] is text field
Can you please help to sort this out.
regards,
MBA