Hi everyone.

I have an sql statement which looks fine to me but for some weird reason is not working. When I hit the command button it does not crash or break or throw up an error but for some reason its not saving the number in dleft into the database.

The following is how my coding was before the change and it worked perfectly:

Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim conn As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Application.StartupPath & "\CNS.mdb")
        Dim cmd As New OleDbCommand
        With cmd
            .CommandType = CommandType.Text
            .Connection = conn
     .CommandText = "UPDATE [Company] SET Dleft = Dleft - " & Val(txtdord.Text) & " WHERE CompID = lblcompid.text"
            .Parameters.Add("@p1", Me.cmbcomp.SelectedValue)
        End With
        conn.Open()
        cmd.ExecuteNonQuery()
    End Sub
However I had to change the coding (the difference is that now I dont want to minus a value in txtdord)

Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim conn As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Application.StartupPath & "\CNS.mdb")
        Dim cmd As New OleDbCommand
        With cmd
            .CommandType = CommandType.Text
            .Connection = conn
            .CommandText = "UPDATE [Company] SET Dleft = Dleft WHERE CompID = lblcompid.text"
            .Parameters.Add("@p1", Me.cmbcomp.SelectedValue)
        End With
        conn.Open()
        cmd.ExecuteNonQuery()
    End Sub
Any ideas why its not working? Thanks