Form Field Disabled if CurrentUser Not Admin

gyli84

Registered User.
Local time
Today, 15:17
Joined
Aug 8, 2001
Messages
25
I have enabled access user level security and workgroups with my database. I have a "Calls" form with the field "Assigned Calls", what I want to be able to do is for this textbox to not be enabled if the person logged in is a "User" as opposed to a member of Admin. Does anyone know how to set or code this?

I also have a textbox on the form called "Logged By". I have a value on another form [Forms]![Helpdesk Staff Switchboard]![Name] which has the name of the person logged in and I would like for this value to be entered into the "Logged By" field on the "Calls" form when the user has finished logging the current problem and clicks to move to a new record. To ensure that no blank records are created though I also need for the user to only be able to move to a new record after certain fields say field1, field2 and field3 have been filled in. I'd be very grateful if anyone had any answers!!

Thanks!
 
Someone told me that I might be able to try:

If CurrentUser = "Admin" Then
MyTextBox.Enabled = True
Else
MyTextBox.Enabled = False
End If

I tried this but even though I was logged in as a member of Admin the textbox was disabled, perhaps because members of Admin are also automatically "Users" too. I tried:

If CurrentUser = Not "Admin" Then
[Assigned User].Enabled = False
Else
[Assigned User].Enabled = True
End If

End Sub

but it did not work due to a type mismatch (Admin is a string not a boolean). Does anyone know how else I can code this? I have also tried If CurrentUser = "Admin" And "User" and got a type mismatch too.
 
I think its better to put the name of user into a variable and then check the condition using variable like:

Dim StrUsr as string
strusr = CurrentUser

If StrUsr <> "Admin" Then
Me.MyTxtBox.Enabled = False
Else
Me.MyTxtBox.Enabled = True
End if

Try this maybe it'll work

Cheers!
Aqif
 
This code looks at whether the currentuser's login name is "Admin" rather than if they are a member of the "admins" group. Does anyone know how it can be modified so it checks whether the user logged in is a member of "Admins" and if not the form field is disabled?
 
I have managed to solve the problem as to disabling a form field if the currentuser is not admin but still have the following problem:
I have a textbox on the form called "Logged By". I have a value on another form [Forms]![Helpdesk Staff Switchboard]![Name] which has the name of the person logged in and I would like for this value to be entered into the "Logged By" field on the "Calls" form when the user has finished logging the current problem and clicks to move to a new record/exits the form.
To ensure that no blank records are created though I also need for the user to only be able to move to a new record/different record or exit the form after certain fields say field1, field2 and field3 have been filled in. Is it possible to do If then statements where there are multiple criteria and if so how would this be applied so that someone could not progress to the next record or be able exit the form until certain fields were filled in?



[This message has been edited by gyli84 (edited 08-17-2001).]
 

Users who are viewing this thread

Back
Top Bottom