basically I have a form with 3 fields, ID, NAME and ADDRESS. What I want to do is after I enter my ID it will fetch the NAME and ADDRESS data from my access database.

I want it to fetch the data after I finish entering the ID, but the problem is its fetching the data every time I enter a letter or number.

If anyone know an easier way to do it let me know.

Public Class Form3
    Private Sub TextBox1_textChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TabIndexChanged
        Dim myCustomer As New Customer
        myCustomer.cid = TextBox1.Text
        If myCustomer.RecExist Then
            TextBox2.Text = myCustomer.CName
            TextBox3.Text = myCustomer.addres
            MessageBox.Show("record not exist")
        End If
    End Sub
End Class

Assembly Class

Public Class Customer
    Public cid As String
    Public CName As String
    Public City As String
    Public Rating As String
    Public orders As New ArrayList
    Private hiddenexist As Boolean
    Public ReadOnly Property RecExist() As Boolean
            RecExist = hiddenexist
        End Get
    End Property

    Public Sub getData(ByVal SearchID As String)
        Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\mcwlse\Desktop\12\SalesDB.mdb"
        Dim objConn As New OleDbConnection(strConn)
        Dim strSQL As String = "select * from customer where cid = '" & SearchID & "'"
        Dim objComm As New OleDbCommand(strSQL, objConn)
        Dim objDataReader As OleDbDataReader
        objDataReader = objComm.ExecuteReader()
        If objDataReader.Read() = False Then
            hiddenexist = False
            MessageBox.Show("Record does not exist")
            hiddenexist = True
            cid = objDataReader("cid")
            CName = objDataReader("CName")
            City = objDataReader("City")
            Rating = objDataReader("Rating")
        End If
    End Sub

LostFocus event might be better for your purposes: Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus