I have created a Login form and coded as below (Before that.. I am very new to VB I have the knowledge only of the basic.) I got the code from this forum itself But it is not working properly
Can anybody help me...
My form contains two textboxes 'TextUserID' and 'TxtPassword' and one Command Button 'CmdLogin'
I have opened the Microsoft DAO 3.6 object library
Here is the code
Private Sub CmdLogin_Click()
If TxtUserID = "" Then
MsgBox "User id required.", vbExclamation
TxtUserID.SetFocus
Exit Sub
End If
If TxtPassword = "" Then
MsgBox "Password required.", vbExclamation
TxtPassword.SetFocus
Exit Sub
End If
Dim tempRecordset As Recordset, Password As String
Set tempRecordset = OpenDatabase("I:\My Documents\Login\Admin.mdb").OpenRecordset(" Select* from User where Ucase(trim(UserID))='" & UCase(Trim(Password)) = "")
If tempRecordset.RecordCount <> 0 Then
Password = UCase(Trim(tempRecordset("Password")))
End If
tempRecordset.Close
Set tempRecordset = Nothing
If Password <> UCase(Trim(TxtPassword)) Then
MsgBox "Incorrect Password", vbExclamation
Else
MsgBox "congatulation"
End If
TxtPassword = Empty
End Sub
On working the following msg is shown
Runtime error'3078'
The microsoft Jet Databaseengine cannot find the input table or query 'False'.Make sure it exists and that its name is spelled correctly.
For testing this I tried by putting the DAO on the form and connected to the Table then it works by showing the records in the text boxes. But it will not serve my purpose
PLease help me
My purpose is to check the Userid and password in the Access Database where it is stored and allow entry to the Programme