Use User Name as password to open form (menu)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am making a unbound form with three command buttons. One button opens
another form with access to all the forms and reports for one dept. Each of
the three command buttons do the same thing for a different department.

I used the wizard to make a command button to "on click" event "Open Form".

I want to add a "password" type requirement that would only allow the people
I place in the =[UserName]="jdoe", or [UserName]="jsmith".

If the user's name does not match those names I have listed, I want a
message box to pop up and say "Please see your supervisor for permissions to
this area" and then go back to the main menu.

I have copied the fsoUserName() function from a previous post and used it to
display the current user's name in an unbound text box on the main form.

I thought I could then state in the "On Enter" event of the Command Button
the wording for the password.

It doesn't work tho. What can I do to fix this. I will need to put in
about 5-6 names that would be acceptable to allow each Main Menu button to
allow just those people into the next menus. This would solve multiple
switchboard updating!

I hope someone can help me figure this problem out = it seems simple in
theory! <smile>

Thanks,
Connie
 
Hi Connie

Connie said:
If the user's name does not match those names I have listed, I want a
message box to pop up and say "Please see your supervisor for permissions
to
this area" and then go back to the main menu.

I have copied the fsoUserName() function from a previous post and used it
to
display the current user's name in an unbound text box on the main form.

I would suggest that instead of having a message pop up when they click a
forbidden button, that you instead hide the button from them. I think users
get annoyed to see an area of an application, and then be told 'you can't go
there'.

In the open event of your unbound form..

Select Case fsoUserName()
Case "jdoe", "jsmith"
Me!Button1.Visible = True
Me!Button2.Visible = False
Case "mcooper", "fjones"
Me!Button1.Visible = False
Me!Button2.Visible = True
Case etc..
etc.
Case else
Msgbox "Please see your supervisor for permissions to this application",
vbOKOnly
End Select
 
Thank you Joan. I am working on taking your advice from a previous question
of mine about using 4 separate switchboards to accomodate the same action.

After reading your earlier posts and realizing how involved keeping four
switchboards up was going to be, I have been working on creating my own menu
system using command buttons and eliminating the need for separate
switchboards by disqualifying entry on the first screen which will just show
4 buttons - one for each department. I will try your text and I think it
will be just what I need.

Thanks again for the support on this!

Connie
 
Back
Top