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

password forms????

Status
Not open for further replies.

madvalpreston

Technical User
Apr 7, 2011
142
GB
Hi



if we have a main menu with 3 buttons



Quote

Sales

Invoice



Is it possible to have some way of blocking a user to access a form OR password the form before it opens.



I have a login form for tha database, but this purely to gain access to the database and then log who is netering a quote etc......



I dont want all users to ahve access to invoicing for example.



Any ideas please
 
One way...
Include a field in your user table to indicate the level of access. Then, in the click event of each button, something like this...
Code:
Select Case UserLevel
   Case 1:
      Msgbox "You are not authorized to view this area"
   Case 2:
      OpenForm.FormName
End Select


Randy
 
Hi

Sorry I am up on coding so much....

I do have a user table with login name and password, and this I use to get into the database..... I adapted this from an example DB.

what I cant work out is how it would work from the Main form to for example Invoice form....

I thought the simplistic way would be to password the form from onclick somehow and if they dont know it then a message box saying incorrect password and then return back to main menu after 3 attempts....

My problem is Im not sure where to start with the programming, if you could advise or point me in the right direction it would be appreciated...

Thanks
 
Add a UserLevel field to the login table.
Assign values to each user, based on the amount of access you want them to have.
Create a public variable.
Code:
Public intUserLevel As Interger

In the login code (when login is successful) set the public variable to the same value as the user.
Code:
intUserLevel = DLookup("UserLevel", "tblLogin", "Name = '" & Me.Name & "'")

On each button, use the code I provided earlier.

Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top