I have a checkbox field named Highlight. When I open the form, I would like this field to be disabled unless CurrentUser = "Admin". Is that possible? And should i be using a macro or some other method?
In The OnCurrent event of the form put this: If CurrentUser="Admin" Then Me.WhateverControl.Visible = True Else Me.WhateverControl.Visible = False EndIf Bonnie http://www.dataplus-svc.com Harvard wrote: >I have a checkbox field named Highlight. When I open the form, I would like >this field to be disabled unless CurrentUser = "Admin". Is that possible? >And should i be using a macro or some other method? -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-macros/200808/1
Harvard, Bonnie has given a VBA solution. A simplified version of her code is: Me.Highlight.Enabled = CurrentUser = "Admin" But yes, you can also do this with a macro. Either using a SetValue action, or SetProperty as you suggested. This would be on the Current event of the form. Set the arguments of the SetProperty action like this: Control Name: Highlight Property: Enabled Value: =([CurrentUser]="Admin") -- Steve Schapel, Microsoft Access MVP Harvard wrote: > I have a checkbox field named Highlight. When I open the form, I would like > this field to be disabled unless CurrentUser = "Admin". Is that possible? > And should i be using a macro or some other method?
Harvard, Just thinking, since the CurrentUser will not change within a given session of the database, you could also put this code on the form's Open or Load event, in fact this would probably be preferable to the Current event. -- Steve Schapel, Microsoft Access MVP Steve Schapel wrote: > Harvard, > > Bonnie has given a VBA solution. A simplified version of her code is: > Me.Highlight.Enabled = CurrentUser = "Admin" > > But yes, you can also do this with a macro. Either using a SetValue > action, or SetProperty as you suggested. This would be on the Current > event of the form. Set the arguments of the SetProperty action like this: > Control Name: Highlight > Property: Enabled > Value: =([CurrentUser]="Admin") >