I'm hoping for someone to be able to offer me some help please? I have spent the last 4 hours trying to fix this problem but not got anywhere. I dont actually have an error code which is making it even more difficult, it just doesnt do anything.
What I am trying to do is Read the value in Textbox2 and minus it from the GamesPlayed field in Table1 where the JobID matches TextBox1.
I dont see what I have done wrong? Many thanks.
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Application.StartupPath & "\Database1.mdb")
Dim cmd As New OleDbCommand
With cmd
.CommandType = CommandType.Text
.Connection = conn
.CommandText = "UPDATE [Table1] SET GamesPlayed = GamesPlayed - " & Val(TextBox2.Text) & " WHERE JobID = TextBox1.text"
.Parameters.Add("@p1", Me.ComboBox1.SelectedValue)
End With
conn.Open()
cmd.ExecuteNonQuery()