-
Hi
My name is Mat Mannion, and I am a student in Ashby Grammar School in Leicestershire (England) studying A-Level IT. I am currently having a problem with adding a password to my database (USING A FORM, NOT THE MAIN PASSWORD) as the school network prohibits adding of user groups to my database. I am planning to have the switchboard options accessible to everybody, but to edit the database one must have the proper authorisation password.
I have a form ready set up, with a password field and an OK button which opens when the Edit Database button is pressed from the main switchboard.
I would like to add some VB Code (ACCESS 97) to the form so that it checks the password entered into the text field and then "validates" it. If the password is correct, it will take the person to the main database screen (IE the one when a new database is started). If the password is incorrect, it will open an error message and return the user to the switchboard.
Please respond ASAP
Mat Mannion
[email protected]
PS Please email me at [email protected] with the information
-
Matt,
You need to set up a table with user names and passwords.
After using the form, you need to set it to Nothing, or the internal data will be retuained.
Code is like
Code:
Dim uName as String, uPass As String
uName = Me.txtUName.Text
uPass = Me.txtUPass. Text
Dim rst as recordset
rst = OpenDynaset("PassTable")
rst.Find "UserName = '" & UName & "'"
If .NoMatch Then ' user not found
MsgBox "Go away"
Else
MsgBox "Welcome"
Open sesame etc...
End If
etc.
Cheers,
Paul