Hi, I am tring to figure out how to search an Access database. Here is my current code...
Dim rstInfo As Recordset
Dim db As Database
Dim item
Set db = OpenDatabase(App.Path & dbpath)
Set rstInfo = db.OpenRecordset("Info", dbOpenDynaset)
rstInfo.FindFirst "Name=" & Criti.Text
With rstInfo
.Edit
Set item = Mlist.ListItems.Add(, , !ID)
If Len(!Name) <> 0 Then item.SubItems(1) = !Name
If Len(!Location) <> 0 Then item.SubItems(2) = !location
If Len(!group) <> 0 Then item.SubItems(3) = !group
If Len(!Notes) <> 0 Then item.SubItems(4) = !Notes
End With
End Sub
Now if I use ID (the key field) then it works fine, but I can't get it it search the Name field for a specific name. Is that possible? Maybe I programmed something wrong?
Dim rstInfo As Recordset
Dim db As Database
Dim item
Set db = OpenDatabase(App.Path & dbpath)
Set rstInfo = db.OpenRecordset("Info", dbOpenDynaset)
rstInfo.FindFirst "Name=" & Criti.Text
With rstInfo
.Edit
Set item = Mlist.ListItems.Add(, , !ID)
If Len(!Name) <> 0 Then item.SubItems(1) = !Name
If Len(!Location) <> 0 Then item.SubItems(2) = !location
If Len(!group) <> 0 Then item.SubItems(3) = !group
If Len(!Notes) <> 0 Then item.SubItems(4) = !Notes
End With
End Sub
Now if I use ID (the key field) then it works fine, but I can't get it it search the Name field for a specific name. Is that possible? Maybe I programmed something wrong?