Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

shpresa
shpresa used Ask the Experts™
on
Hello
When i expert a report in excel it gives me this errror: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

It is so strange to me, the report itself is fine, it works with my old database, but recently i upgraded to a cloud solution and it gave the above error. All other reports work but this.

Any suggestion?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010

Commented:
How is the report export being done?
Retired
Distinguished Expert 2017
Commented:
All that error message is stating is that the collection you are accessing with the index is less then 0 which is not valid because a list only has positive index starting at 0 or the index you are using is greater then the number of elements in the collection which is invalid because the last index is one less then the total number of elements in the collection because collections are zero based index.

Can you post the code where this is happening please.

Author

Commented:
I understand,
to me what makes it more weird is the the same code works fine when connected to my old database, the error does not show, once i connect it to the new database which it should be identical, the error shows up. It sounds to me that something within the database is bothering it. I have a lots of coding on this as it involves a whole report but I will and see if i can find anything within the database. Thanks

Author

Commented:
Apperently i had done a chance on the database that effected it. I had reduced a value, or taken a row down. Thanks.
Fernando SotoRetired
Distinguished Expert 2017

Commented:
Not a problem shpresa, glad to help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial