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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can Access 97 identify users & limit access

Status
Not open for further replies.

Cowboysooner

Technical User
Joined
Oct 2, 2001
Messages
19
Location
US
Is it possible, when opening access 97 for the program to ask the user his name (or other identifier) and then auto populate fields with the user's info (for example division, location, name, address) [maybe using autoexec] while allowing the user to only look at data he has input? I don't need to restrict users from seeing the entire database, I just want their login process to display their particular accounts for efficiency.

I have a large database with many users and divisions for the entire State of Florida and want to get away from users having to scroll through enormous amounts of data from other users.
 
Hi Baffelgab,

The 1st requirement is that there needs to be some way to associate records with users. Access connot inherently identify who created each record (at least I don't think it can). So you need a field to store that information.
Other ways: associate by customer ID, account ID, etc.
Once you get the method you want to use worked out, use a query for the recordsource of your form with the criteria set to each user's needs.

You don't even have to have the users log in. You can read their login ID by using ENVORON("Username") and use that to set the query criteria.

Hope that helps,

Ken
 
[ENVORON("Username") doesn't do anything in my tests, and neither does ENVIRON("Username").]

If you're going to record who logs in, you should really use Access's built in user-level security. It takes a while to learn, but it's quite a good tool. There's a copy of the FAQ on my website. It'll take a few reads, and a few attempts at securing a database, but it's well worth it. Learn that and you'll be in great shape to do all of what you're talking about. Ken is right that you'll have to add a field to each table in which you want to record who created the record, but that's easy enough.

Jeremy =============
Jeremy Wallace
AlphaBet City Dataworks

Take a look at the Developers' section of the site for some helpful fundamentals.
 
Hi Jeremy,

Yep, I did mis-spell ENVIRON() but it really does work. I've used it on my work systems (NT 4.0 workstations on NT & Windows 2000 Servers) and even on my home PCs which are not connected to any network (Windows 2000 & Windows NT).
Maybe the USERNAME parameter isn't valid on your configuration. This procedure will display all the environment:
Sub getenv()
dim i as integer
Do
i=i+1
Debug.print Environ(i)
Loop until Environ(i)=""
end Sub
 
Hmm. Weird. Certainly works when I test it now. Nice code, to.

Jeremy =============
Jeremy Wallace
AlphaBet City Dataworks

Take a look at the Developers' section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top