VB6 database login

Get new comments by email
You can cancel email alerts at anytime.
Comments (1)

Linkman in London, United Kingdom

101 months ago

I have created a program, it allows accounts to be created and saves them into a "login" table onto an access 2003 database, containing the fields "username" and "password"

I'm now trying to create a login form, which should check the database to see if the username and password combination is there and then accept the user into the system if their details are correct. I have written the code below but get 'error 91' when running the code.

Anyone know where I'm going wrong? Thanks.


Private Sub imgOk_Click()
Dim answer As Integer
Dim username As String
Dim password As String

username = txtUsername.Text
password = txtPassword.Text

Do While Not adoLogin.Recordset.EOF
If username = adoLogin.Recordset.Fields("Username") And password = adoLogin.Recordset.Fields("password") Then
answer = MsgBox("Right", vbOKOnly)
Unload Me
answer = MsgBox("Wrong", vbOKOnly)
End If
End Sub

- Was this comment helpful?
Reply - Report abuse

» Sign in or create an account to comment on this topic.