database - field[counterx3 - Id(text)Primary Key]

my code works really well before but when i changes and add codes in the others forms i got error in updating the value in my database, here's my code for update

 sql = "update counterx3 set ID='" & Val(acsdr!ID) + 1 & "'"
        Dim ccmd = New OleDb.OleDbCommand(sql, con)
        ccmd.ExecuteNonQuery()
        ccmd.Dispose

and here's the other one

    Public Sub ordernumber()
        sql = "select * from counterx3"
        Dim cmd = New OleDb.OleDbCommand(sql, con)
        acsdr = cmd.ExecuteReader()
        If acsdr.Read Then
            lblordernum.Text = "ORDER NUMBER: " & acsdr!ID
        End If
        Me.Refresh()
    End Sub

my error is in the update, it says "No data exists for the row/column."
Please help, i'm working on this error since last night :( , but i really can't figure out what the reason of the error

Can you capture the error in debug mode so we can see which line produce the error.

Try to verify if the variables that host data to be updated to a database do return or hold something, mean check if they are not null, because it seems as if one or more variable has no data within it, its null.

it's not null, actually when i save a new record in database in different field the counterx3-id need to be increment

This article has been dead for over six months. Start a new discussion instead.