Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to make password a variable

Status
Not open for further replies.

Linda354

Technical User
Jan 2, 2002
59
US
I've created a large database for an AA type organization. They have a long form for clients, asking a lot of very personal questions. I've set up a basic security logon with the wizard which allows the counselors access. In addition to that, we want each counselor to only be able to view and edit his own clients. (There's a level of trust there, so I don't think airtight security is necessary.) What I'm trying to set up is an input form which asks them again for their password, then hangs onto that as a variable, which is then used in various forms to list only their own clients.

I have a switchboard set up. I'm trying to write an initial switchboard that leads us to a form asking for our passwords. If the password entered isn't listed in the routine, they can't enter. If it is listed, the password is carried as a variable which a query will use in the next form to generate the appropriate list of clients.

I knew dBase a million years ago, but could use a jumpstart on coding this in VBA.

Thanks
 
I'm wondering now, when users go through the log on process, is there some way to grab their password as a variable so that it's not necessary to have it input again?
 
I have created a login within a database and wanted to be able to have the current user details handy all the time. I got around this by opening a hidden form with the current logged on user name within a text field in the form. If the user closes or logs out of the database then the form closes.
I hope this might help you.
 
Are you using the built in Access security, or a custom-made login-form?

If you are using the latter, it should be pretty simple to grab their password. I would then recommend assigning it to a public global variable (a public variable declared within a standard module).

James Goodman
 
I am using the latter. User clicks OK on the login form, verifies username and password in table, then opens main menu and hidden user details form. The hidden form contains the current user name. I then use this in the other forms that I have created as a quick reference and any documents created have that username inprinted on them.
 
I am not sure if I am missing something here. You can always find out who is running the current session of the application using the function CurrentUser()
i.e.
'***********
if currentuser() = "myuserid" then
MyCtl.visible = true
end if
'******************

. I often use this in conjunction with a function that checks to see if a user is in a particular group.

'***************************
'Determine if a User is in a given Group:

Function IsUserInGroup(strGroup As String, strUser As String) As Integer
' Returns True if user is in group, False otherwise

Dim ws As DAO.Workspace
Dim grp As Group
Dim strUserName As String

Set ws = DBEngine.Workspaces(0)
Set grp = ws.Groups(strGroup)
On Error Resume Next
strUserName = ws.Groups(strGroup).Users(strUser).Name
IsUserInGroup = (Err = 0)
End Function
'****************************************

I guess I am not getting why you need to know the password as opposed to the current user and the security group(s) they are members of....

Jayde
 
I'm using the built in security. How would I go about grabbing the password as a variable? How would I code that?
 
Unfortunately, I dont think it is possible to get the password of a user, when using built in security. It looks like the password property is a write only one.

I therefore suspect you may not be able to get a users password... James Goodman
 
Jayde, the CurrentUser() function would do it. It's only if I had to get users to re-enter ID info that I figured I would need the password.

I have to admit, my fourteen year old knows more VBA than I do, so we'll play with this approach this afternoon and let you all know if we get stuck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top