log in once

alanbredbury

New member
Local time
Today, 18:41
Joined
Nov 11, 2011
Messages
2
I have a log in with password in a opening form once the user logs in successfully a main form comes up. There are several buttons on this screen each of which opens a different form. I want to trap the user name from the login form and pass it to the subsequent forms so I can lock out fields for editing based on the user name. This seems like it should be simple however if I can't have a global variable!!! how do I accomplish this.
Thanks
 
Keep your subform opened throughout the session and hide it when not in use, then refer to the username textbox in the login form to get the username.

Forms!LoginForm!UserNameTextbox
 
Ugg it's been a couple years since I did any coding in this app and stuff that used to be simple isn't anymore.
 
It will come flooding back to you very soon ;)

By the way, I meant form not subform.
 
Create groups for you users.
i.e. Group 1 = Admin, Group 2 = Power User, Group 3 = Data Caputure Slaves

Have a hidden form open when a user logs on
In that form have an unbound field "Group" that gets the group number for that user.

In you form/s have a Select Case

Code:
Select Case Forms!HiddenForm!Group
   Case 1
      Button_EnterData1.Enabled = True
      Button_EnterData2.Enabled = True
      Button_EnterData3.Enabled = True

   Case 2 
      Button_EnterData1.Enabled = True
      Button_EnterData2.Enabled = True
      Button_EnterData3.Enabled = False

   Case Else    ' Other values.
      Button_EnterData1.Enabled = True
      Button_EnterData2.Enabled = False
      Button_EnterData3.Enabled = False

End Select
 

Users who are viewing this thread

Back
Top Bottom