Can't Update Table

  • Thread starter Thread starter Robert S. Johnson
  • Start date Start date
R

Robert S. Johnson

The following line of code will not update my table. No
matter what i do I get a 'Run time error 3251' - "Object
or provider is not capable of performing requested
operation".

The table is created by importing data from an Excel
worksheet. I have tried changing the name of the field to
be updated; I have deleted the table and re-imported it. I
do not have an check constraints set. Both the value to be
put in the table and the field in the table are text
fields. The "Left(pstrAgyObj, 2)" produces the correct
value to be placed in the table.

!fldSmallObj = Left(pstrAgyObj, 2)
 
Try posting the code that opens the recordset. That's probably where the
problem is.
 
Here the code. The code stops running at:
!fldSmallObj = Left(pstrAgyObj, 2)

Dim connLA2DObj As New ADODB.Connection
Dim prstLA2DObj As New ADODB.Recordset
Dim pstrSQL As String, pstrAgyObj As String

pstrSQL = "SELECT fldAgyObj, fldSmallObj FROM tblTest"

'Makes connection to current project.
Set connLA2DObj = CurrentProject.Connection
prstLA2DObj.Open pstrSQL, connLA2DObj, adOpenKeyset

'Loops through the data base putting two digit objects in
the table.
With prstLA2DObj
Do Until .EOF
pstrAgyObj = !fldAgyObj
!fldSmallObj = Left(pstrAgyObj, 2)
.Update
.MoveNext
Loop

'Displays the record count.
txtRecCnt.Text = .RecordCount

'Closes the recordset.
.Close
End With

If Not prstLA2DObj Is Nothing Then Set prstLA2DObj =
Nothing
If Not connLA2DObj Is Nothing Then Set connLA2DObj =
Nothing
End Sub
 
Back
Top