Set an access db login form

D

Dan

Your answer is appreciated!!!

How this user id and password can be changed/made by user
without accessing the code?!?

Private Sub cmdOK_Click()
If Me![txtUserName] = "TTS" And Me![txtPassword]
= "TTS" Then
DoCmd.Close

Else
MsgBox "Invalid passowrd, please re-enter your
passowrd", , "Checking Password..."
Exit Sub
End If

End Sub
 
R

Rick B

If you want to create a password, use the built in security of Microsoft
Access.

If you don't want to use that, you would need to store the UserID and
passwords in a table and write code that would allow users to update them.
There would be many issues with security and preventing people from going
directly to the table and viewing everyone's userid and password.

Rick B

Your answer is appreciated!!!

How this user id and password can be changed/made by user
without accessing the code?!?

Private Sub cmdOK_Click()
If Me![txtUserName] = "TTS" And Me![txtPassword]
= "TTS" Then
DoCmd.Close

Else
MsgBox "Invalid passowrd, please re-enter your
passowrd", , "Checking Password..."
Exit Sub
End If

End Sub
 
G

Guest

Hi Rick:

Yes, I do not want to use the buit in security. For my
option (table with userid and password) the code is not
working, I do not know why. I was wondering if there is
another way?

Thanks,

Dan
 
R

Rick B

To use the built in security no code is involved. Read the Security FAQs on
Microsoft's website. They will walk you through securing a databse, adding
users and passwords, etc.

Rick

Hi Rick:

Yes, I do not want to use the buit in security. For my
option (table with userid and password) the code is not
working, I do not know why. I was wondering if there is
another way?

Thanks,

Dan
 
G

Guest

Again, Rick, please read below; I do not want to use the
MS built in security>

Thanks,

Dan
-----Original Message-----
To use the built in security no code is involved. Read the Security FAQs on
Microsoft's website. They will walk you through securing a databse, adding
users and passwords, etc.

Rick

Hi Rick:

Yes, I do not want to use the buit in security. For my
option (table with userid and password) the code is not
working, I do not know why. I was wondering if there is
another way?

Thanks,

Dan
-----Original Message-----
If you want to create a password, use the built in security of Microsoft
Access.

If you don't want to use that, you would need to store the UserID and
passwords in a table and write code that would allow users to update them.
There would be many issues with security and preventing people from going
directly to the table and viewing everyone's userid and password.

Rick B

Your answer is appreciated!!!

How this user id and password can be changed/made by user
without accessing the code?!?

Private Sub cmdOK_Click()
If Me![txtUserName] = "TTS" And Me![txtPassword]
= "TTS" Then
DoCmd.Close

Else
MsgBox "Invalid passowrd, please re-enter your
passowrd", , "Checking Password..."
Exit Sub
End If

End Sub


.


.
 
R

Rick B

Well, your code is checking for a hardcoded userid and password. Your code
below states that the user must enter "TTS" for both the userid and
password. Is that what you want?

If so, it looks like the form will close. If not, then a message is
displayed.

If you want to look at a table for these values, then you must totally
rewrite the code. You need to grab the userid entered and perform a lookup
on a table where the userid an password are stored. The code needs to
retrieve the password from the table and store it in a variable. The code
then needs to compare the variable to the password entered by the user. You
can then perform one of two functions based on if they match or not.

To have the user change their password, you would need to write completely
different code.

In other words, start over from scratch. The code you have below will not
do what you are asking to do.



Rick B


Again, Rick, please read below; I do not want to use the
MS built in security>

Thanks,

Dan
-----Original Message-----
To use the built in security no code is involved. Read the Security FAQs on
Microsoft's website. They will walk you through securing a databse, adding
users and passwords, etc.

Rick

Hi Rick:

Yes, I do not want to use the buit in security. For my
option (table with userid and password) the code is not
working, I do not know why. I was wondering if there is
another way?

Thanks,

Dan
-----Original Message-----
If you want to create a password, use the built in security of Microsoft
Access.

If you don't want to use that, you would need to store the UserID and
passwords in a table and write code that would allow users to update them.
There would be many issues with security and preventing people from going
directly to the table and viewing everyone's userid and password.

Rick B

Your answer is appreciated!!!

How this user id and password can be changed/made by user
without accessing the code?!?

Private Sub cmdOK_Click()
If Me![txtUserName] = "TTS" And Me![txtPassword]
= "TTS" Then
DoCmd.Close

Else
MsgBox "Invalid passowrd, please re-enter your
passowrd", , "Checking Password..."
Exit Sub
End If

End Sub


.


.
 
B

Beryl Small

Okay, I want to help you but I need a little more information. Are you trying to access the MS Access database through a regular MS Access form or a .NET web application? If it is an MS Access database is it a .mdb file or a .adp file?
 
G

Guest

It is a regular MS Access file, and *.mdb...

Thanks,

Dan
-----Original Message-----
Okay, I want to help you but I need a little more
information. Are you trying to access the MS Access
database through a regular MS Access form or a .NET web
application? If it is an MS Access database is it a .mdb
file or a .adp file?
 
G

Guest

Yes,thank you, Beryl, it is not working; I am getting the
message that I do not have Admin permissions; it is still
looking at some built in MS security...I think.

Dan
 
J

Jim/Chris

I got this from a post by Howard Brody. I have not tried
it but it looks preety straight forward.

OK, a couple of assumptions:

Your login form has two TextBoxes (txtUserID and
txtPassword) and a CommandButton (cmdLogIn)
Your database has a global variable (gstrUserID) for
storing the current user tblLogIn has only one record for
each user and UserID and Password fields.

The user enters their UserID and Password and then clicks
cmdLogIn. Try this code in the OnClick event for cmdLogIn:

Private Sub cmdLogIn_Click()

' verify a user id and password have been entered. If not,
display an error message and end the sub
If IsNull([txtUserID]) Or [txtUserID] = "" Then
MsgBox "You forgot to enter your UserID. Please try
again.",,"Oops!"
txtUserID.SetFocus
Exit Sub
End If

If IsNull([txtPassword]) Or [txtPassword] = "" Then
MsgBox "You forgot to enter your password. Please try
again.",,"Oops!"
txtPassword.SetFocus
Exit Sub
End If

' otherwise...

' declare variables
Dim i as Integer
Dim strUserID as String
Dim strPWEntered As String
Dim strPWActual As String

strUserID = [txtUserID]
strPWEntered = [txtPassword]

' verify the UserID is valid (in the table). If not,
display and error message and end the sub.
' This validation can also be done in the AfterUpdate event
of the txtUserID control
i = DCount("[UserID]","tblLogIn","[UserID]='" & strUserID &
"'")

If i =0 Then
MsgBox "You have entered an invalid UserID. Please try
again.",,"Oops!"
[txtUserID] = ""
[txtPassword] = ""
txtUserID.SetFocus
Exit Sub
End If

' look up actual password
strPWActual = DLookUp("[PAssword]","tblLogIn","[UserID]='"
& strUserID & "'")

' compare passwords. If they match, log in and set the
global UserID variable. If they don't, display
' an error message and end the sub
If strPWEntered = strPWActual Then
MsgBox "You are logged into the database"
gblnUserID = strUserID
' any other login code here
Exit Sub
Else
MsgBox "You have entered an invalid password. Please
try again.",,"Oops!"
[txtUserID] = ""
[txtPassword] = ""
txtUserID.SetFocus
Exit Sub
End If

End Sub

Hope this helps!

Jim
 

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

Top