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!

Access, change the security user using VBA???

Status
Not open for further replies.

lixperry

Technical User
Jun 16, 2006
4
US
With the security built into access, it comes with the default security users; "User", & "Admin"
(you can add more of course)

My question is;
Can you progmaticly change the database's security user currently logged in using vba?

For example;
I have code that gets your username from windows. So if "jsmith" opens the database it will set him as "User", and then if "mjohnson" opens the database it sets him to "Admin"


If anyone can help me with this I would apreciate it.

Thanks,
Keith
 
I don't know for sure, but I wouldn't think you could do that inside of Access.

I have an idea though. Maybe you could make a batch file or script that does some sort of mapping of network logins to Access logins. The script would build the command line dynamically, setting the appropriate /user and /pwd arguments. Then have your users start Access through the batch file.


 
Why not just build Access user accounts under Tools > Security > User and Group Accounts ?

To take full advantage of Access User Level Security, each user logging into the database should have their own username and password.

If the database is on a network with multiple LAN users logging in, the workgroup file should be in a shared folder as well. Open the database using a shortcut that has a "/wrkgrp location of your workgroup file" parameter in the shortcut's target line.


~Melagan
______
"It's never too late to become what you might have been.
 
I have the feeling the OP wants to spare the users having multiple logins (i.e. one for the network, one for the database). Similar to the way you can assign user rights to SQL Server based on their network credentials.

 
Joe,

That said, there is no need to set user-level security. Just usage of a shared folder with restricted access to only those who are to use the file, with read-write-delete-excute permissions granted on the folder.

Well, Keith?
 
Jerry Klmns , not really the same thing at all! Within the data base, users may (should) have different permissions to the separate objects. It is common to want to restrict salary and benefits information from general (public) access (would you want the secretarial staff to know your salary, marital status, number of children, home address and phone number ... or do you think they want you to have unrestricted access to their information?



MichaelRed


 
MichaelRed said:
would you want the secretarial staff to know your salary, marital status, number of children, home address and phone number
You haven't seen them! Neither one! So let me say yes on this and hope they give me call! [wink]

Sorry MichaelRed. Couldn 't help it.

Now, if the OP just doesn't want them to have an extra password to type and press Enter, she has to built the checking of allowed operations to be carried out from each user. Or do what Melagan suggests.
 
One thing I've noticed about Access User Level Security is that the login dialogue box automatically fills the username field with your windows profile username. If you create each user with the same username in Access as Windows, that'll save your users from having to type in a (different) username.

That aside... after the first time you log into Access, it remembers the last username logged in on that particular Windows profile.

~Melagan
______
"It's never too late to become what you might have been.
 
Melagan, that's why I said "to have an extra password to type and press Ente"

But it seems that we are having a nice conversation witout the OP. Keith, is there anything usefull info or it's all greek to you???
 
Thanks all for your words. After doing quite a bit of searching, and from reading your responses, It looks like what I am looking for doesn't exist.

but lucky thing, I just got a new job so the new guy will have to deal with it.

The thing I was going to suggest to the new guy is move everything over to an sql server, and use business objects. A co-worker has shown that to me, and it looks pretty cool.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top