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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple-step operation generated errors

Status
Not open for further replies.

nnmmss

Programmer
Sep 7, 2004
123
IR
I have a listview and dataGrid and a recordset. when a user select an item from listview, that item is added into recordset and will be set to datagrid datasource
the brief code is like that.

'Defining recordset
Set rstDG = New ADODB.Recordset
rstDG.Fields.Append "Id", adDouble
rstDG.Fields.Append "PackedNo",adVarChar,255,adFldIsNullable
rstDG.Fields.Append "Deliver",adVarChar,255,adFldIsNullable
rstDG.Open

'In item check of listview, the selected item is added to RS
With rstDG
.AddNew
!Id = ListViewGoods.ListItems(i).SubItems(5)
!PackedNo = ListViewGoods.ListItems(i).SubItems(8)
!Deliver = ListViewGoods.ListItems(i).SubItems(9)
.Update
End With

but in "!Deliver = ListViewGoods.ListItems(i).SubItems(9)" I get this error "Multiple-step operation generated errors"
i can't understand that. "ListViewGoods.ListItems(i).SubItems(9)" contains a number , but i have tested it by direct assigning like
!Deliver = "5" or other value but nothing has changed.
Actually this problem arises when want to edit the values in the list( suppose i want to add an item to the existing list) but if i want to creat a new list and add new items in that new list everything is ok.

any idae is appreciated
 
This error occurs when you attempt to put data in to a field where the field is not capable of storing the data. For example, if you have a field that is set to varchar(255) and you assign it to a string that is 500 characters long, you will get this error.

Perhaps, all you need to do is trim the string, or even take the Left(value, 255).

Hope this helps.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
You also need to verify the field type that you have set up in your database. There's a HUGE difference between the two rows

!Deliver = "5"
!Deliver = 5

If your database field is an int, the first one will cause an error. The second will cause an error if your database field is text. I would put a breakpoint in your code right before that line so you can see EXACTLY what is getting passed, then verify that the database can handle it. Keep in mind, if it has "" around it, the database sees it as a text and not all databases will allow it to be entered, even if it is a number.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top