faatimah
April 20th, 2001, 10:47 AM
HELLO ALL,
i don't know how to explain this...but basically i have databound-textbox controls associated with my ado object that show the current record, now when i search for a specific record i want to update my view to show me the searched criteria, that is the last name and update all the other textboxes to the values corresponding to the lastname. Something like making my ado recordset move to the searched value.
here is what i have but it just renames the name in the lastName field to the searched value.
Private Sub mnuSearch_Click()
Dim pstrLastName As String
Dim sql As String
pstrLastName = InputBox("Enter name", "Find")
If pstrLastName <> "" Then
sql = "SELECT * FROM Employees WHERE LastName = " & Chr(34) & pstrLastName & Chr(34)
data.con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\CaseStudies\Mscb.mdb;Persist Security Info=False")
data.record.Open sql, data.con
If data.record.EOF = True Then
MsgBox ("there are no records")
Else
txtFields(2).Text = data.record!LastName
End If
data.record.Close
data.con.Close
End If
End Sub
THANK YOU ,
FATIMA
i don't know how to explain this...but basically i have databound-textbox controls associated with my ado object that show the current record, now when i search for a specific record i want to update my view to show me the searched criteria, that is the last name and update all the other textboxes to the values corresponding to the lastname. Something like making my ado recordset move to the searched value.
here is what i have but it just renames the name in the lastName field to the searched value.
Private Sub mnuSearch_Click()
Dim pstrLastName As String
Dim sql As String
pstrLastName = InputBox("Enter name", "Find")
If pstrLastName <> "" Then
sql = "SELECT * FROM Employees WHERE LastName = " & Chr(34) & pstrLastName & Chr(34)
data.con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\CaseStudies\Mscb.mdb;Persist Security Info=False")
data.record.Open sql, data.con
If data.record.EOF = True Then
MsgBox ("there are no records")
Else
txtFields(2).Text = data.record!LastName
End If
data.record.Close
data.con.Close
End If
End Sub
THANK YOU ,
FATIMA