shabbaranks
Registered User.
- Local time
- Today, 15:02
- Joined
- Oct 17, 2011
- Messages
- 300
Hi All,
Im trying to tidy up the form access as before I had it look up a name on a form. Now Im controlling it by groups. Ive added a yes/no field to a table and the VBA looks to see if they are set to yes or no. If yes they can access the necessary form if no a message box appears.
If ticked it works fine but if I set the value to false (unticked) I get the error invalid use of Null - is null the same as no ticked? If so shouldn't it work?
Thanks
Im trying to tidy up the form access as before I had it look up a name on a form. Now Im controlling it by groups. Ive added a yes/no field to a table and the VBA looks to see if they are set to yes or no. If yes they can access the necessary form if no a message box appears.
If ticked it works fine but if I set the value to false (unticked) I get the error invalid use of Null - is null the same as no ticked? If so shouldn't it work?
Code:
Private Sub Admin_btn_Click()
Dim sAdminUser As Boolean
sAdminUser = DLookup("AdminUser", "UserNames_tbl", "[sUser] = '" & Me.LoggedInUser & "' AND [AdminUser] = True")
If sAdminUser = True Then
DoCmd.OpenForm "SubmittedTimesheet_frm"
Else
MsgBox "You cannot access this function"
Exit Sub
End If
End Sub
Thanks