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!

password tables 1

Status
Not open for further replies.

lashwarj

IS-IT--Management
Nov 1, 2000
1,067
US
I have a table name security, in this table i have two feilds one username the other password. on the main form i want the user to enter the username and password and then click a command button that will check to see if the username and password on main form are equal to the username and password in the security table. I can not seem to get this to work .
 
This is how I did this recently in a database.

You need to create a recordset which calls all data from the Users/Passwords table, a record at a time. This ensures that each User is associated with the correct Password.


Dim rs_check_users As Recordset
Set rs_check_users = CurrentDb.OpenRecordset("Select * from Users")

Do While Not rs_check_users.EOF
If (strUserName = rs_check_users!User) And (strPassword = rs_check_users!Password) Then
intAccess = 1
End If
rs_check_users.MoveNext
Loop

If intAccess <> 1 Then
intAccess = 2
MsgBox &quot;Access denied&quot;
End If

DoCmd.Close acForm, &quot;frmLogOn&quot;

One other thing I did that I found useful. I didn't allow the users to enter the User name. Instead on the log on form, I had a drop down box populated with the Users from the Users table. This gets around the possibility of users putting in their name in a different format than exists in your tables.

Hope this helps,

Brendan
 
Why are you doing this? Ms. Acess has a &quot;Built in&quot; Security system. Use the tool provided with the product - unless you can find a real flaw in it.


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Michael,

I had to do this as whoever set up the Access workgroups security where I work hadn't done such a good job. Joining the workgroups set security measures on Access in general and not just the database I wanted to protect.

I didn't set the Database Password under the tools option because although I had all the data in an Access database, the interface was a separate Visual Basic program and setting the Database password complicated the connection I was using (MS Datalink and Data Environment). I had so many problems trying to pass the user name and password to the Datalink file that I gave up.

I spoke to a few others I work with and one suggested building in my own rather crude security. Hence, the rather messed up code above.

All that said, your point is well made and LASHWARJ would probably be better off looking into the built in security. It just didn't work for me.

Brendan
 
Brendan,

Thank you for your post.your procedure is work perfectly
Budi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top