I have a set of command buttons on a form that open up a series of reports. The problem I have is that only certain users should have access to particular reports and I want to be able to put some kind of password protection in.
If anyone knows how to do this please let me know.
The simplist, since you already have the form with command buttons, is to put in the code for the "secure" command buttons an InputBox requesting the password. InputBox is a simple message box that prompts the user for a typed input. You then chack that against a known value to see if it is valid. Access help has sufficient information to show use of this command.
From here, you can start going into all kinds of directions to make it more, shall we say, professional.
1) Use a popup form instead of the InputBox command, since a popup can be completely customized, including setting the text box input mask to "Password", which gives you the *** as you type.
2) Use an internal table to hold the password, so that you can change it later.
3) Use the API call to identify the login ID of the current user. With this, you can have a table setup to identify if the user is allowed to have that report or not, thereby skipping the password altogether (since a password is useless once it's figured out).
4) Again, using the API to ID the user, you can disable the controls they are not allowed to use when the form opens. A quick way to do this is by using the Tag property, and a 'For Each Control ... Next loop'.
There are probably about thousand other ways to do this.