Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim frm1 As New Form1
        Dim n As String = Label4.Text
        Dim ConStr As String = "provider=microsoft.jet.oledb.4.0;" & _
        "data source= " & Application.StartupPath & "\" & "Mydata.mdb;"

        Dim connection As New OleDb.OleDbConnection(ConStr)
        Dim savinto As New OleDb.OleDbCommand

        savinto.Connection = connection
        savinto.CommandType = CommandType.Text
        savinto.CommandText = "UPDATE Table1 SET nom= '" & Trim(TextBox1.Text) & "' ,prenom = '" & Trim(TextBox4.Text) & "' ,tel = '" & Trim(TextBox3.Text) & "',adresse='" & Trim(TextBox5.Text) & _
        " ' ,ville = '" & Trim(TextBox2.Text) & " ' ,serie = ' " & Trim(TextBox6.Text) & "',poid = '" & Trim(TextBox7.Text) & " ' WHERE poid = '" & n & " ' "
        Try

            connection.Open()
            savinto.ExecuteNonQuery()
            connection.Close()
            MsgBox("data has been added")

        Catch ex As Exception

        End Try
        frm1.Show()
        Me.Hide()


    End Sub

====Please help why it dosn 't work

Without the error message or output, this is just a guess.

Are any of the fields in Table1 not string. You might have to convert the Textbox.Text to a double, real, or possibly date.

a wild guess... your field "nom" is the primary key and set as identifier. If so, then u you shouldnt update this field.
Also you try to update the field "poid" which you use in your where clause.

Don't use concatenate sql strings Read SQL-Injection - http://msdn.microsoft.com/en-us/library/ms161953.aspx

Dim ConStr As String = "provider=microsoft.jet.oledb.4.0;" & _
        "data source= " & Application.StartupPath & "\" & "Mydata.mdb;"

Dim connection As New OleDb.OleDbConnection(ConStr)
Dim savinto As New OleDb.OleDbCommand

savinto.Connection = connection
savinto.CommandText = "UPDATE Table1 SET nom=@nom,prenom =@premon WHERE poid=@poid"

'Add parameters

saveinto.Parameters.AddWithValue("@nom",TextBox1.Text)
saveinto.Parameters.AddWithValue("@premon",TextBox2.Text)
saveinto.Parameters.AddWithValue("@poid",n)

connection.Open()
savinto.ExecuteNonQuery()
connection.Close()
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.