Disable checkbox based on y/n field in another table

jrhessey

Registered User.
Local time
Yesterday, 19:54
Joined
Nov 3, 2004
Messages
29
First off I found this post and didn't think it would be to difficult to implement, and I think that where I went wrong. (the thinking part) ;)

http://www.access-programmers.co.uk/forums/showthread.php?t=36385&highlight=check+box+enable+field


What I am trying to do is disable fields on a form based on who is logged on to a pc. I have made a "Permissions" table with a groups field, username, and ordr_sent_sched field. I've also "Dim" ed Groups.

Here is the code I'm trying to implement. I want to use the true false value from the permissions table to tell the form if the button/field/checkbox should be enabled or disabled. Here is the code...

PHP:
Groups = DLookup("[group]", "Permissions", "[LoginName] = '" & fOSUserName & "'")
        Select Case Groups
            Case "AD"
                Me.Option1.Enabled = Nz(Table!Permissions!ordr_sent_sched)
        End Select

However when I run my switchboard, I get an error 424 object required. When I mouse over the Me.Option1.Enabled I get a caption that says

PHP:
Me.Option1.Enabled = True

whether I have the ordr_sent_sched box checked in the permissions table or not.

When I mouse over Table!Permissions!ordr_sent_sched I get:

PHP:
Table!Permissions!ordr_sent_sched = <Object Required>


I step through and everything checks out, groups returns AD like it should.

Can someone please help me out here and tell me what I've done wrong? Any help is greatly appreciated! Thanks!
 
nevermind... using this code fixed it...

PHP:
Groups = DLookup("[group]", "Permissions", "[LoginName] = '" & fOSUserName & "'")
        Select Case Groups
            Case "AD"
                Scheduling_Release = DLookup("[ordr_sent_sched]", "Permissions", "[LoginName] = '" & fOSUserName & "'")
                Me.Option2.Enabled = Scheduling_Release
                
        End Select
 

Users who are viewing this thread

Back
Top Bottom