|
-
Jun 20th, 2000, 09:31 PM
#1
Thread Starter
New Member
Hi...
I have been working on a project that uses MS Access as the backend for my database application. I need to have a function that will check whether the logon information (i.e. username, password) is correct. If false, then show logon form again and wait for the correct answer before opening db. I already set a password on the Access db.
Any feedback will be deeply appreciated.
Sincerely,
<U> src="http://www.geocities.com/ogmaciel/vbguy74.swf" quality=high bgcolor=#336699 WIDTH=76.5 HEIGHT=76.5 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></U>
"Don't let school interfere with your education." Mark Twain
-
Jun 22nd, 2000, 01:43 AM
#2
Frenzied Member
Do you need/want to use Access security (.mda/.mdw files) or are you planning on writing your own?
-
Jun 22nd, 2000, 08:39 AM
#3
Addicted Member
What ive done in the past is have the .MDB reside on a hidden server and share (\\server$\dbshare$\file.mdb) and in the client, a table with usernames and passwords. For a login check, id use something like in the code below...
Code:
Public Function LoginValid(Username As String, Password As String) As Integer
' Assume that adoConn is already opened to the DB file/server
adoRset.Open "SELECT * FROM dbusers WHERE username = '" & Username & "'", adoConn, adOpenStatic + adOpenForwardOnly, adLockReadOnly
If Not adoRset.EOF Then
adoRset.MoveFirst
If Password = adoRset("password") Then
' Valid username and password
LoginValid = 100
Else
' Valid username, password is invalid though
LoginValid = 50
End If
Else
' Username is not valid
LoginValid = 0
End If
End Function
Private Sub Command1_Click()
Select Case LoginValid(txtUsername.Text, txtPassword.Text)
Case 0: MsgBox "Invalid username you rat bastard!"
Case 50: MsgBox "Invalid password for the specified user!"
Case 100: MsgBox "You have been succesfully logged in!"
End Select
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|