After successful log in, you need to check the privilege of the same user from database. If the user has desired privileges then enable the password change form else disable that.
debasisdas
Posting Genius
6,968 posts since Feb 2007
Reputation Points: 722
Solved Threads: 457
Skill Endorsements: 20
As Chris has stated, the following -
You currently have
in my database. i have created two tables. one for the users which i renamed "userstbl" which includes the ff fields
1. userid (pk)
2. username
3. userpass
the second table is called "privtbl" which includes the ff fields.
1. privilege (not auto number. i assign 1's randomly)
Add privilege to your "userstbl". This save you plenty of extra coding just to get the value from the second table "privtbl"
Now, add a module to your app and declare the variable that will hold the value of the user -
''In your module below Option explicit
Public xUser As Integer
''In your Form1 part, where the username and password is true the following -
Else
' a condition should be written here. or perhaps another elseif
xUser = db!privilege
Form2.Show
Unload Me
This value will now be available throughout your application. Lets say that on form2 you have a button that will enable the user to edit his username or password, the following -
Private Sub Form_Load()
if xUser = 1 Then
''User can edit data...
cmdEdit.Enabled = True
Else
cmdEdit.Enabled = False
End if
End Sub
AndreRet
Industrious Poster
4,706 posts since Jan 2008
Reputation Points: 391
Solved Threads: 481
Skill Endorsements: 20
Question Answered as of 1 Year Ago by
ChrisPadgham,
AndreRet
and
debasisdas