D
Dave Rudolf
Hey all,
I have a block of code that sometimes works and other times not. It is trying
to manually populate a combo box with a column from a table. The table is
being accessed by an ADO data control that is connected to an Access database
via an ODBC driver. The code I have just iterates through the ADODC's record
set, as follows:
Dim found
found = False
If Not ado.Recordset.RecordCount = 0 Then
ado.Recordset.CancelUpdate
Dim fieldIndex As Integer
fieldIndex = find_field_index(ado, fieldName)
Dim valueStr As String
' If the field's type is a string, then add single quotes
' to the value.
Select Case ado.Recordset.Fields(fieldIndex).Type
Case 200 'TODO: Add other magic numbers used by the VB libs
valueStr = "'" & fieldValue & "'"
Case Else
valueStr = fieldValue
End Select
' ********** Error occurs on the next line ********
ado.Recordset.MoveFirst
ado.Recordset.Find (fieldName & " = " & valueStr)
found = Not ado.Recordset.EOF
End If
The error I get is:
[Microsoft][ODBC Microsoft Access Driver] Operation must use updateable
query.
My understanding of that error means that there was a problem writing data to
the database. Correct me if I am wrong, but the above code should not be
trying to write anything, should it? So why could that error be occurring some
of the time?
Thanks
Dave
I have a block of code that sometimes works and other times not. It is trying
to manually populate a combo box with a column from a table. The table is
being accessed by an ADO data control that is connected to an Access database
via an ODBC driver. The code I have just iterates through the ADODC's record
set, as follows:
Dim found
found = False
If Not ado.Recordset.RecordCount = 0 Then
ado.Recordset.CancelUpdate
Dim fieldIndex As Integer
fieldIndex = find_field_index(ado, fieldName)
Dim valueStr As String
' If the field's type is a string, then add single quotes
' to the value.
Select Case ado.Recordset.Fields(fieldIndex).Type
Case 200 'TODO: Add other magic numbers used by the VB libs
valueStr = "'" & fieldValue & "'"
Case Else
valueStr = fieldValue
End Select
' ********** Error occurs on the next line ********
ado.Recordset.MoveFirst
ado.Recordset.Find (fieldName & " = " & valueStr)
found = Not ado.Recordset.EOF
End If
The error I get is:
[Microsoft][ODBC Microsoft Access Driver] Operation must use updateable
query.
My understanding of that error means that there was a problem writing data to
the database. Correct me if I am wrong, but the above code should not be
trying to write anything, should it? So why could that error be occurring some
of the time?
Thanks
Dave