Customizing Field Display Depending On User

LOISEAUD

New member
Local time
Today, 12:28
Joined
Aug 30, 2006
Messages
2
Hi,

I am looking for a way to customize fields to be hidden or not depending on user in forms or reports.

Any idea ?

I wanted to explore the customisation of each query but there must be an easier way to save personal parameters somehow so that the user would go through the forms and hide the non necessary fields once and we would then save somewhere these settings for each user.

Has anybody already experienced such a request ?
 
One possible way:

Create a textbox in your form and use the "environ function"
to capture the user name. Store this in the textbox.
You can set the textbox visibility to false if you desire.

Now depending on the value of your textbox, you can
set elements' visibility in your form to true or false in the
"Onload" event.

Control source of your textbox: = Environ("Username")

This is probably the easiest and quickest way to do it.
 
Last edited:
Many thanks for your help I think it may work.

Just to be more precise, where can I find the "On Load Event", in the form ?
And something else, where would you recommend to store what is visible for which user, in a table ?
 
In design view, you will find "On Load" under the "Events" tab
of the form properties. This is where you need to write some vba code
to set the visibility of your form elements depending on which user is
appearing in your text box. In this case, the user name is synonymous
to the network user name.

You do not store the visibility property in the tables. You set
visibilities to true or false in your form via vba code... eg:

If Me.txtUserName = "Tom" then
Me.textbox1.visible = true
else
Me.textbox1.visible = false
End If

You can also set the visibility properties of command buttons,
combo boxes, check boxes, subforms, etc, etc.
 
Last edited:
What I do is create a login form and each user has their own username and password to the system. User details such as dept, admin or normal user etc are stored in a user table. Following successfull login I stored relevant details in global variable which are then checked in the on load event of forms. I then make controls vaisible or enabled etc subject to the value of the global variables. This saves hard coding the names of users into forms as suggested by edtab.

In this way I also make certain forms unavailable to users that do not have admin rights to the system. I find my way is overall much simpler than using the awful Access security system.

HTH
 
Another alternative that I use

I classify users into Types

Readers
Editors
etc

All applications are network based so I detect the network login and compare this to the contents of either Reader table, Editor Table etc and switch command buttons On as defined

Means also that if a User login id is not detected as being in any table then the application quits.

Means that you can also assign a Core user who has access to everything and you can make them responsible for administering the Access control tables. he who requested teh application shall be the Core user (administrator)


Len
 

Users who are viewing this thread

Back
Top Bottom