Quantcast
Channel: VBForums - Database Development
Viewing all articles
Browse latest Browse all 2918

VB6 - Row cannot be located for updating

$
0
0
I am using a bound DataGrid Control and ADO to read email messages. When a new message is read, a boolean field is updated to show that it has been read. To get around delay issues with updating the database and the error:
"Row cannot be located for updating. Some values may have been changed since it was last read.",
I use the following code to force the database to be updated.
Code:

    'Update database as message read
    If lblBox.Caption = "InBox" Then
        DataGrid1.Col = 3
        If DataGrid1.Text = False Then
            DataGrid1.Text = True
            DataGrid1.Col = 0
            'Trigger update
            Adodc1.Recordset.MovePrevious
            Adodc1.Recordset.MoveNext
        End If
    End If

This works for the most part, but if I go off and perform some other functions before coming back to read a new message, I still get the above error. Unfortunately I have not been able to isolate what those "other functions" are, as it happens quite rarely. The operation still succeeds, but it crashes the program because I do not trap this particular error.

Any ideas?

J.A. Coutts

Viewing all articles
Browse latest Browse all 2918

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>