Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 695
  • Last Modified:

ADO adNumeric Error

The code

    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    rs.Fields.Append "test1", adNumeric
    rs(0).Value = 1

On the line that sets the value for the field I get the error :  "Multiple-step operation generated errors. Check each status value."

I am using ADO 2.7.

This snippet is part of a larger project, and I DO NOT have the ability to change to one of the other datatypes such as adCurrency.  

Any suggestions on how to stop the error would be greatly appreciated.  

- Jeremy
  • 2
1 Solution
since you have created what appears to be a disconnected recordset, what are you trying to UPDATE.  Update serves to post the recordset BACK to the underlying Table in the connected database.  Since you don't have an underlying table, where is the UPDATE supposed to go?

thedude__Author Commented:
Great question.  

As you pointed out, the recordset does post the changes back to a table in the database.  This is true if you are actually connected to a database.  

If you are not connected to the database the update will update the local memory resident disconnected recordset.

My error actually occurs in the "rs(0).Value = 1" statement.  For some reason I am unable to update the Numeric type of field.

You should set the NumericScale and Precision for the field after you add it:

rs.Fields.Append "test1", adNumeric
   rs(0).NumericScale = 10
   rs(0).Precision = 28

This should work for your example.
See the ado help file or Microsoft site for more info for NumericScale and Precision
thedude__Author Commented:
Awesome, thanks.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now