Hi, i am currently writing a code for a login screen. However I am getting a "run time error 424" object required. I have had very little experince using databases for programming. Any help on how to correct the issue would be greatly appreciated.
I am using visual basic 6 and MS access 2000
Login Form
Private Sub cmd_clear_Click()
txt_password.Text = "" 'Clear the password field
txt_userID.Text = "" 'Clear the username field
End Sub
Private Sub cmd_close_Click()
End 'close down the program
End Sub
Private Sub cmd_login_Click()
rs.Open "Select * from user where ID='" & txt_userID.Text & "' and password='" & txt_password.Text & "'", cn, adOpenKeyset, adLockOptimistic
If rs.RecordCount = 0 Then
MsgBox "The user ID or Password is incorrect", vbCritical, "Failure"
Else
frm_main.Show
Unload Me
End If
rs.Close
End Sub
Private Sub form_load()
txt_password.Text = "" 'Clear the password field
txt_userID.Text = "" 'Clear the username field
End Sub
module
Option Explicit
Public Function OpenDatabase(DatabasePath As String) As Boolean
Public cn As New ADODB.Connection
Public rc As New ADODB.Recordset
Public cnStr As String
Set cn = New ADODB.Connection
cnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:\My Documents\School Work\Computing\Coursework\Database\CPT6 Database.mdb;" & DatabasePath
End Function
Thanks in advance
Reiko