THIS IS THE CODE WHERE I CLICK A BUTTON TO SIGN UP FOR AN ACCOUNT

Set db = New ADODB.Connection
    db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\useraccount.mdb"

Set rs = New ADODB.Recordset
        rs.Open "Select*from useraccounts", db, adOpenStatic, adLockOptimistic

rs.AddNew
    rs!Lastname = Text1.Text
    rs!Firstname = Text2.Text
    rs!Contact = Text3.Text
    rs!UserName = Text4.Text
    rs!Password = Text5.Text
    rs!question = Text6.Text
    rs!answer = Text7.Text
rs.Update
    MsgBox "Account Successfully Created!", vbInformation, "Employee Registration Records..."
Form3.Hide
Form1.Show

THIS IS THE CODE WHERE I CLICK A BUTTON TO LOG IN

Set db = New ADODB.Connection
        db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\useraccount.mdb"

    Set rs = New ADODB.Recordset
        rs.Open "Select*from useraccounts", db, adOpenStatic, adLockOptimistic

            If Text1.Text = rs!UserName And Text2.Text = rs!Password Then
                MsgBox "Welcome!!!", vbInformation, "Log-in"
            Form2.Show

            Else
                MsgBox "Username or Password is Incorrect! You Cannot Access The Program. Register first!", vbExclamation, "Log-in Version 2.0.."
                    With Text1
                        .Text = ""
                        .SetFocus
                    End With
                        Text2.Text = ""
          Text3.Text = Val(Text3.Text) + 1
          End If
End Sub

on the above codes they all have

Dim rs As New ADODB.Recordset
Dim db As New ADODB.Connection

the problem is it can't read the account created. what do you guys think is the problem.. please do help me. oh this is for VISUAL BASIC 6.0

THANKYOU GUYS FOR THE HELP!

You can simply try this logic.

select count(*) from useraccounts where username = val1 and password= val2.

if the above query returns 1 (as count). login should be successful and allow the user to proceed further else re-prompt for correct username and password(and repeat the same logic).

For the above logic to work the username column should be an unique column in the DB table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.