can you help me on this code..

Private Sub cmdRead_Click()
Dim target As String
lstName.Clear
target = txtIdTag.Text
If target = "" Then
MsgBox "You must enter a tag number"
txtIdTag.SetFocus
Exit Sub
End If
target = "id tag=" & target
datStudent.Recordset.FindFirst target
If datStudent.Recordset.NoMatch = True Then
MsgBox "No records found"
txtIdTag.Text = ""
txtIdTag.SetFocus
Else
Do Until datStudent.Recordset.NoMatch = True
lstName.AddItem datStudent.Recordset("name")
datStudent.Recordset.FindNext target
Loop
End If
End Sub


i don't know what wrong with this code.when i run this code,i'm still getting error..

Recommended Answers

All 4 Replies

I revised a little bit your code...
What line does the error appear? sorry got no vb6 on my machine :(

Private Sub cmdRead_Click()
      Dim target As String

      lstName.Clear

     If txtIdTag.Text = vbNullString Then
             MsgBox "You must enter a tag number", VbInformation
             txtIdTag.SetFocus
             Exit Sub
      End If

      datStudent.Recordset.FindFirst  "id tag=" & txtIdTag.Text

      If datStudent.Recordset.NoMatch Then
            MsgBox "No records found"
            txtIdTag.Text = ""
            txtIdTag.SetFocus
     Else
           Do Until datStudent.Recordset.NoMatch
                  lstName.AddItem datStudent.Recordset("name")
                  datStudent.Recordset.FindNext "id tag=" & txtIdTag.Text
           Loop
      End If
End Sub

what kind of error occurred? more details.

tq guys.i've got the solution for dis code already..

then mark it solve. and how u solve it, post here. then others can understand it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.