Password protection username and logon in startup form

M

Mesa

Well, this is my objective. I want to start up the database so that
when the startup form opens, it will have the fields "Username" which
I select from a combo box and "Password" which I will type. I would
then press a button and if the password is correct, the rest of the
database would become accessable and it will open a new form.

Currently I have no clue how to accomplish this. I just made the table
to store the username and password and from there im in the wind.
Coding, links and example databases are GREATLY appreciated.
 
R

Rick Brandt

Mesa said:
Well, this is my objective. I want to start up the database so that
when the startup form opens, it will have the fields "Username" which
I select from a combo box and "Password" which I will type. I would
then press a button and if the password is correct, the rest of the
database would become accessable and it will open a new form.

Currently I have no clue how to accomplish this. I just made the
table to store the username and password and from there im in the
wind. Coding, links and example databases are GREATLY appreciated.

Access has User Level Security built in that will do this in a manner that would
require the purchase of hacking utilities to get past it. Anything you do
"home-grown" can be defeated in a matter of seconds by those familiar with how
Access works. For instance, the table that you store your user name and
password in can be easily linked to or imported into another file for anyone to
examine.

If you need "security" against people who might actually try to get to stuff you
don't want them to then don't waste your time with anything home-grown. If the
data is particularly sensitive then don't store it in an Access/Jet database at
all. Use a server database with real security.

If you just want to provide guidance to people who aren't that interested in
getting around your protection then what you're attempting might be reasonable.
Just use the DCount() function to see if the user name and password entered
exists in your table. If it does then open your menu form and if it doesn't
exit the app or display an error.

If DCount("*", "TableName", "UserNameField = '" & Me!UserName & "' AND
PasswordField = '" & Me!Password & "'") > 0 Then
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "MenuFormName"
Else
MsgBox "Bad user name or password"
DoCmd.Quit
End If
 
D

Douglas J. Steele

Rick Brandt said:
Access has User Level Security built in that will do this in a manner that
would require the purchase of hacking utilities to get past it. Anything
you do "home-grown" can be defeated in a matter of seconds by those
familiar with how Access works. For instance, the table that you store
your user name and password in can be easily linked to or imported into
another file for anyone to examine.

If you need "security" against people who might actually try to get to
stuff you don't want them to then don't waste your time with anything
home-grown. If the data is particularly sensitive then don't store it in
an Access/Jet database at all. Use a server database with real security.

If you just want to provide guidance to people who aren't that interested
in getting around your protection then what you're attempting might be
reasonable. Just use the DCount() function to see if the user name and
password entered exists in your table. If it does then open your menu
form and if it doesn't exit the app or display an error.

If DCount("*", "TableName", "UserNameField = '" & Me!UserName & "' AND
PasswordField = '" & Me!Password & "'") > 0 Then
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "MenuFormName"
Else
MsgBox "Bad user name or password"
DoCmd.Quit
End If

And if you want the passwords to be case-sensitive, try:

If DCount("*", "TableName", _
"UserNameField = '" & Me!UserName & _
"' AND " & _
"StrComp(PasswordField, '" & Me!Password & "', 0)=0") > 0 Then
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "MenuFormName"
Else
MsgBox "Bad user name or password"
DoCmd.Quit
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Username and password 5
Edit Form 1
Password Form 4
username and password form 3
Username/Password Form 1
username and password 2
username and password controls 1
store username in textbox in Outlook form 0

Top