Icon View Incident Report

Serious Serious
Reported By: Vinnie Murdico
Reported On: 10/15/2002
For: Version 3.18 Build 1
# 1249 Problem Updating Records from VB6 After Navigating Using Next Method

I have a small VB 6 test program that opens a table and reads through it. It has two edit boxes on the form that allow me to edit the "summary" field (string field) and then click another button to update the current record with the data that may have been edited.

But when I run this, I can navigate forward through the records just fine, but attempting an update causes an error 3146 - ODBC Call Failed. The wierd thing is, I can open the recordset, immediately do a MoveFirst and then edit/update the first record ok. Once I do a MoveNext or a MoveLast followed by an Edit, I can no longer do an Update without getting the error. It only seems to like updating the first record for some reason.

Option Explicit

Dim RS As Recordset
Dim DB As Database
Dim WS As Workspace

Private Sub UpdateBtn_Click()
    RS.Fields("Defect") = Text1.Text
    RS.Fields("Summary") = Text2.Text
End Sub

Private Sub MoveNextBtn_Click()
    Text1.Text = RS.Fields("Defect") & ""
    Text2.Text = RS.Fields("Summary") & ""
End Sub

Private Sub Form_Load()
    Set WS = CreateWorkspace("", "", "", dbUseODBC)
    Set DB = WS.OpenDatabase("Test", False, False, "ODBC;dsn=Test;")
    Set RS = DB.OpenRecordset("SELECT Defect, Summary FROM Defect", 
dbOpenDynamic, 0, dbOptimistic)
    If (Not RS.EOF) Then
      Text1.Text = RS.Fields("Defect") & ""
      Text2.Text = RS.Fields("Summary") & ""
    End If
End Sub

Comments Comments
Problem was with ODBC 2 compatibility regarding the row set size. The row set was being fetched in 100-record increments, and using ODBC 2 functionality (required by VB6) the updating was not using the proper row set size.

Resolution Resolution
Fixed Problem on 10/15/2002 in version 3.19 build 1