In the line
Code:
If (DLookup("[SecurityLevel]", "Users", "[User]='" & tbUserName & "'") = "Admin") Then
there should be double quotes around ADMIN, not single quotes. The outermost parentheses are not needed
I tried and tried to get the macro to set the enabled property of button2 but no joy. I really detest macros!
I finally got the button to be enabled, BUT I had to convert the macro to VBA code and edit the code.
Code:
'------------------------------------------------------------
' Command4_Click
'
'------------------------------------------------------------
Private Sub Command4_Click()
On Error GoTo Command4_Click_Err
If (DLookup("[Password]", "Users", "[User]='" & tbUserName & "'") = tbPass) Then
If (DLookup("[SecurityLevel]", "Users", "[User]='" & tbUserName & "'") = "Admin") Then
DoCmd.OpenForm "Home", acNormal
Forms!Home!btn2.Enabled = True
End If
End If
Command4_Click_Exit:
Exit Sub
Command4_Click_Err:
MsgBox Error$
Resume Command4_Click_Exit
End Sub
**You really should take the time to give meaningful names to your objects.