Click to See Complete Forum and Search --> : Security.bas


Michael C. Griffith
January 2nd, 1999, 02:16 PM
I am using VB5 to learn VB with. I an going through exercises in a beginners book and have come to a stumbling block. The book refers to using a procedure in s file caled Security.bas. I searched for this file, but I did not find the file anywhere. I called a friend for help, but he did not have a clue either. Can someone help me with this or possibly send me a copy of the file? I am just learning and not sure what to do right now. Thanks ...mike...

Heru
November 30th, 1999, 07:38 AM
Hi Michael!
I'm learning VB6. One of my previous assigment had security.bas file. I faced with the same problem like you did, noone was able to help me find the solution to that, so finally I didn't use security.bas.
I guest security.bas works for VB5????

I have an example of security.bas from that assignment ( My assignment was to create a logon form using this file). Hopefully this code will give you some idea of how security.bas look like. Tell me if this help solve your problem ok? Heru
------------------------------------------------------------------------------------------------------------------------------------------

Option Explicit

'declare DAO variables
Private db As Database
Private rs As Recordset

Public Function GoodCredentials(UserName As String, Password As String) As Boolean
'This function is exposed to the project and is used to check _
the user name and password passed from the Logon form. If the _
user name and password are found, the function returns True.

'Use DAO to create a recordset object to search.
Set db = OpenDatabase("\Data\Security.mdb")
Set rs = db.OpenRecordset("tblUsers", dbOpenDynaset)

'Search the recordset object for the user name.
rs.FindFirst "[UserName] = '" & UserName & "'"

'If the user name is found and the password for that record _
matches the password given by the user, the credentials are _
good; if no user name is found or if the password is not _
correct, the credentials are bad.
If Not rs.NoMatch And rs![Password] = Password Then
GoodCredentials = True
Else
GoodCredentials = False
End If
End Function