VB Code:
Set db = OpenDatabase("C:\Windows\Desktop\inventory.mdb")
strSQL = "SELECT * FROM Current WHERE ID = " & txtID.Text
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
If rs.RecordCount > 0 Then
'Text1.Text = rs!ItemNo & "" 'substitute real field names
buff = rs!Price '& ""
lstReceipt.AddItem buff
txtID.Text = ""
Else
MsgBox "No Match found for that ID.", vbCritical
End If
rs.Close
db.Close
VB Code:
Private Sub cmdLogin_Click()
Uname = txtUsername.Text
Pword = txtPassword.Text
Set db = OpenDatabase("C:\Windows\Desktop\users.mdb")
MsgBox "got here"
strSQL = "SELECT * FROM usertable WHERE Username = " & Uname
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
If rs.RecordCount = 0 Then MsgBox "No user by the name " & Uname & ". Please check the name you entered.", vbInformation: Exit Sub
TestPass = rs!Password
If TestPass = Pword Then MsgBox "Correct password!"
rs.Close
db.Close
End Sub