R
Robert Johnson
I am trying to parse portion of a string and put the
results in a field in a table. The following code stops
at !fldSmallObj = pstrTrans (pstrTrans has the right value
to be placed in the table). The error message is "object
or provider is not capable of performing the requested
operation." I have rebuilt the data base and table using
different names several times always but I always get the
same results. For over a month and a half I have posted
this request for help on several Access forum sites to
date no one has come up with a solution. I am not married
to my code. I need to get the 2 characters into the field
in the DB without having to deal with 13k records
manually, so if anyone has a different way of doing this I
would be most appreciative if you would share your
solution with me.
The following code stops at; !fldSmallObj = pstrTrans
Private Sub cmd2DObj_Click()
'On Error GoTo Err_cmd2DObj_Click
Dim connLA2DObj As New ADODB.Connection
Dim prstLA2DObj As New ADODB.Recordset
Dim pstrSQL As String, pstrAgyObj As String
Dim pstrTrans 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
pstrTrans = Left(pstrAgyObj, 2)
!fldSmallObj = pstrTrans
.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
results in a field in a table. The following code stops
at !fldSmallObj = pstrTrans (pstrTrans has the right value
to be placed in the table). The error message is "object
or provider is not capable of performing the requested
operation." I have rebuilt the data base and table using
different names several times always but I always get the
same results. For over a month and a half I have posted
this request for help on several Access forum sites to
date no one has come up with a solution. I am not married
to my code. I need to get the 2 characters into the field
in the DB without having to deal with 13k records
manually, so if anyone has a different way of doing this I
would be most appreciative if you would share your
solution with me.
The following code stops at; !fldSmallObj = pstrTrans
Private Sub cmd2DObj_Click()
'On Error GoTo Err_cmd2DObj_Click
Dim connLA2DObj As New ADODB.Connection
Dim prstLA2DObj As New ADODB.Recordset
Dim pstrSQL As String, pstrAgyObj As String
Dim pstrTrans 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
pstrTrans = Left(pstrAgyObj, 2)
!fldSmallObj = pstrTrans
.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