Jump to content

search in access Database - VB 2005

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
kadosh1000

kadosh1000

    Newbie

  • Members
  • Pip
  • 4 posts
Hi, I running a form that searches in an access database,
I want to know what happens in case there are more than one matches.
I'm using the dao.Recordset.seek function to search.
How can I get all of the matches into one label???

Thanks,
Kadosh1000


#2
kadosh1000

kadosh1000

    Newbie

  • Members
  • Pip
  • 4 posts
i did it by my self :

        Dim i As Integer = 0
        Dim se as string
        Label4.Text = ""
        Label5.Text = ""
        se = TextBox1.Text
        TextBox1.Text = ""
        Table.Index = "Se"
        Table.Seek("=", se)
        If Table.NoMatch Then
            MsgBox("השם לא נמצא", MsgBoxStyle.Critical, "לא נמצא")
        Else
            Do While Not Table.EOF
                Dim na(i), us(i) As String
                If Table.Fields("Name").Value = se Then
                    us(i) = Table.Fields("User").Value
                    na(i) = Table.Fields("Name").Value
                    If Label4.Text = "" Then
                        Label4.Text = us(i)
                        Label5.Text = na(i)
                    Else
                        Label4.Text = Label4.Text & vbCrLf & us(i)
                        Label5.Text = Label5.Text & vbCrLf & na(i)
                    End If
                    Table.MoveNext()
                    i += 1
                Else
                    Table.MoveNext()
                End If
            Loop
        End If