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

Only let people open Access form by clicking button 1

Status
Not open for further replies.

dan08

Technical User
Jan 7, 2013
51
US
I just had an idea, that might just be a stroke of genius. I am working on a database that I want to have different levels or permissions. I want people to just use the forms and reports I create for them. These will only let you access certain things. All objects will be hidden in the Navigation Pane, but that is easy to circumvent.

Example:
Non-admin opens the database and some kind of initial navigation form is shown. Buttons that lead to forms they are not allowed to access are hidden. But this person can still unhide the objects in the navigation pane and open them that way.

This is my stroke of genius. Maybe?
On all my buttons I will pass an OpenArg in the OpenForm function. Then in the OnOpen method of that form, if the OpenArg is not correct, I will close it and display a msgbox that it can't be opened. I think this will really help achieve the security I am looking for.

What do you guys think? Will this cause any problems for users that are doing things correctly (i.e. just using my forms)? Are there still simple ways to circumvent this? Do you have any additional suggestions for this idea?
 
Good thinking. There are lots of ways to control usage but most can be worked around by savvy users. Is your application front-end saved as an ACCDE so users can simply go into the design view of your forms and change your code?

When I need to implement some type of security, I will base it on the user's network login. Here is a function that returns the login name.

Duane
Hook'D on Access
MS Access MVP
 
The frontend is an ACCDB file with the important tables living in a SQL Server DB connected via ODBC. As of now the users can open the forms in design view, but I will be working on disabling that.

I am doing something similar using the network login. user = Environ$("Username") to get the username on the frontend, and something similar to filter the information on the backend.

Here is something I have yet to figure out: Can I make a linked table such that it can be used for a form as a record source, but a user cannot open it regularly and edit it?
 
If you don't want a user to edit a SQL Server table, consider using a pass-through querty. They are very efficient and don't allow editing. You can hide these like other objects as well as create them on the fly.

Duane
Hook'D on Access
MS Access MVP
 
But I do want to be able to edit the data in a form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top