Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO.Recordset.Update error

Status
Not open for further replies.

julieatnexus

Technical User
Nov 10, 2000
13
US
I have the following for/next loop in my project. When I enter a number for the fields value (ie.ADOSO.Recordset.Fields("Due") = 20), the update works. When I enter the variable 'y'(ie. ADOSO.Recordset.Fields("Due") = y) , it gives me a run-time error :Multiple-step operation generated error. Check each status value.

The variables 'qty' and 'y' are both integers.



For x = 1 To ADOSO.Recordset.RecordCount
If qty = 0 Then
ADOSO.Recordset.Fields("Due") = ADOSO.Recordset.Fields("qty")
ADOSO.Recordset.Update
ADOSO.Recordset.MoveNext
Else

If ADOSO.Recordset.Fields(&quot;qty&quot;) <= qty Then
ADOSO.Recordset.Fields(&quot;Due&quot;) = 0
ADOSO.Recordset.Update
qty = qty - ADOSO.Recordset.Fields(&quot;qty&quot;)
ADOSO.Recordset.MoveNext
Else
y = ADOSO.Recordset.Fields(&quot;qty&quot;) - qty
ADOSO.Recordset.Fields(&quot;Due&quot;) = y
ADOSO.Recordset.Update
qty = 0
ADOSO.Recordset.MoveNext
End If
End If

Next x

Any help you can give would be greatly appreciated.

Thanks,

Julie
 
The error your getting simply means that one or more fields you are inserting/updating contain an invalid value (such as a string for a numeric field. I'm not sure what your field data types are but there is a mismatch somewhere for sure. Step through the code with the watch window showing the following:

ADOSO.Recordset.Fields(&quot;Due&quot;)
ADOSO.Recordset.Fields(&quot;qty&quot;)
y
qty

Keep your eye on the datatypes
Make sure they are all the same datatypes.
This should clear up the problem.

Joe Logan
Joseph Logan
jlogan@softsource.net
 
Also check for a value larger than 32767... the error returned usually isn't the one that you stated, but you never know.... :)

Dave
 
It seems like you're trying to assign an invalid datatype to the field.

Try this:


ADOSO.Recordset.Fields(&quot;Due&quot;) = cInt(y)


--NipsMG
 
It was a datatype mismatch due to how I created the field within an SQL query. I corrected the query and it works great. Thanks for all of your help!

Julie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top