Hi, I am using the following code for a login form. For some reason if i have multiple users in a database it will only work with the first user. So it wont check the second line in the database, only the first one.
Heres the code
Any ideas?Code:Dim db As Database Dim rs As Recordset Dim ds As Recordset Dim WS As Workspace Set WS = DBEngine.Workspaces(0) dbfile = ("C:\AddressBook.mdb") pwdstring = "swordfish" Set db = DBEngine.OpenDatabase(dbfile, False, False, ";PWD=" & pwdstring) Set rs = db.OpenRecordset("SELECT * FROM `agents`") If Text1.Text = rs("username") And Text2.Text = rs("password") Then MDIForm1.Show MainForm.BtnSaveToWaveFile.value = "1" Me.Hide Else MsgBox "Incorrect Username or Password", vbCritical Text1.SetFocus End If
Jamie




Reply With Quote