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!

help with run-time error

Status
Not open for further replies.

Tailgun

Technical User
Mar 30, 2002
417
US
I have an app with a number of forms. I have a save option and a save/exit open in the menu. The save option saves any changes to the db and refreshes the forms so other things can be done. The save/exit option saves the changes to the db and closes all the ado connections and closes the forms leaving the user the main form open to do other things. Here is my problem. Sometimes I get this error when the user selects either save or save/exit it doesn't matter I still get the same error. I hope someone can help with this this its driving me nuts. Or show me how to handle the error.

error msg
Run-Time error 2147217887(80040e21)
Multiple-step operation generated errors. Check each Status value
------------
Thanks for any and all help. I need to get this solved asap.
 
Hi,

"Multiple-step operation generated errors" is an ADO error, that indicates, that the operation you've request, produces several errors, not a single one.
As there are several errors, they are unnable to be shown in the ERR object, that can only shows a single error at a time.
The multiple Errors in ADO, became from the way things are done (Provider, connection etc.)ADO has its own Error Object, where it keeps info about Errors!
Please check microsoft information(for the version of ADO you are using), about errors in ADO.
 
Not sure if this is relevant, but I have had various problems with VB interacting with but not in sequence with an Access db. VB would ask for something to be done, Access would tell VB that it was complete and VB would carry on - but Access was still completing part of its operation. This caused various problems - basically saying that a table wasn't there when after a short period later it actually was. To correct this, I had to build my db connection before and close it after (and set variables to Nothing) any db operation such as a create table. You may also like to view the answers given to my topic "VB to Access table problems" for use of the Refreshcache method.
 
Simonkue--thanks for answering I'm using a SQL db so I think the best approuch is what CmPaiva said in the response. I'll let you both know when I get this problem sorted.

Thanks again.
 
Try putting this in your code.
[tt]
'Database Code
Dim ADOerr As ADODB.Errors

'Error trapping Code
For i = 1 To ADOerr.Count
MsgBox ADOerr.Item.Description
Next i
[/tt] Craig, mailto:sander@cogeco.ca

Si hoc legere scis, nimis eruditionis habes
 
Thanks CraigSander

I will give it a try
 
When I add that I get this msgbox

Compile Error:
Arguement not optional

and it stops on item in the below code section

MsgBox ADOerr.Item.Description

?
 
Looks like it should have been
MsgBox ADOerr.Item(i).Description
 
Thanks dwunz

I tried that and now get this error

Runtime error 91
object variable or With block variable not set

?

Thanks for any help
 
I was having that issue as well, and we were doing some heavy ADO stuff . . . things that should work did not, and not all the time. This worked for me, and so it might work for you.

Get the latest, greatest MDAC and install it. Part of my problem was I had gotten bits and pieces from different versions, and now the versions were falling apart. See if that solves the problem for you.
 
Thanks LlomaxX

As you say, things work very well most all the time then stuff like this starts to happen for no reason then goes away then comes back. I'll try your suggestion.

Thanks again
 
object variable or with block not set will occur when you try to set a value of something improperly.

A few of the more common things I have found that create this are:

Fields that have the same name as VB commands
[tt]
Text1.Text = rs!DateTime
[/tt]
Where DateTime is a field in the DB. ADO compiled will not see that DateTime is actually a field and will think it is a command. So rather than interpreting it as get the value of the field DateTime from the rs recordset, it will convert it to get the value of DateTime '12/12/2002 02:00:34 PM' and ask it to get the value of the field '12/12/2002 02:00:34 PM'. Which of course doesn't exist.

Do you get what I mean It's converting DateTime to the command which returns the current Date and time and then asking for that column. What I do to get around this is set the field name differently.
[tt]
Text1.Text = rs.Fields("DateTime")
[/tt]
Another Problem is with NULLS
[tt]
rs!field1 = MyVariable
[/tt]
I have seen this cause the same error where MyVariable has no value. i.e. It was dimentioned but has no real value or is null. Similarily:
[tt]
myVariable = rs!field1
[/tt]
will give the same error if the value in field1 is a NULL. You can't assign Nulls. What I do to get around this is:
[tt]
rs!field1 = MyVariable & ""
myVariable = rs!field1 & ""
[/tt]
No records left

If your on the last record or there are no records at all you can also get this error. It will try to retrieve a value from a record that isn't there.

Hope some thing here helps. What I would say to do is if you know which function it's dying in, put lines in to trace where it gets to before dying.

Let us know
Craig, mailto:sander@cogeco.ca

Si hoc legere scis, nimis eruditionis habes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top