# ACCOUNTSANDSUBACCOUNTSWITHHISTORY Function giving an index error when using "\*" or All

**URL:** <https://community.velixo.com/t/accountsandsubaccountswithhistory-function-giving-an-index-error-when-using-or-all/51>\
**Category:** Q&A\
**Tags:** Acumatica\
**Created:** [March 15, 2024, 6:27am UTC](https://community.velixo.com/t/accountsandsubaccountswithhistory-function-giving-an-index-error-when-using-or-all/51 "2024-03-15T06:27:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maximilian\_Dyer](https://community.velixo.com/letter_avatar_proxy/v4/letter/m/439d5e/32.png) [@Maximilian\_Dyer](https://community.velixo.com/u/Maximilian_Dyer)\
**Post date:** [March 15, 2024, 6:27am UTC](https://community.velixo.com/t/accountsandsubaccountswithhistory-function-giving-an-index-error-when-using-or-all/51/1 "2024-03-15T06:27:32Z")

</div>

Hello, when I am using the =accountsandsubaccountswithhistory function, I have encountered an error that I was previously not getting, and I am not sure what is causing this.

When I use “\*”, or leave blank for BranchorRange, I get an error:

| Connection 'Error! Index was out of range. Must be non-negative and less than the size of the collection. This happened after closing and reopening my workbook, and it was working fine before. Now the only way I can get this function to work appropriately is to designate a specific branch, which is not what I want to do. Has anyone encountered this or know what may be causing it? Function with error:Function when designating a specific Branch: | | | — | |  
| — | — |

Any ideas would be much appreciated! Thanks!

---

<div class="post-metadata">

**Author:** ![Gabriel](https://community.velixo.com/user_avatar/community.velixo.com/gabriel/32/7_2.png) [@Gabriel](https://community.velixo.com/u/Gabriel)\
**Post date:** [March 15, 2024, 12:00pm UTC](https://community.velixo.com/t/accountsandsubaccountswithhistory-function-giving-an-index-error-when-using-or-all/51/2 "2024-03-15T12:00:42Z")

</div>

Hi Max,

It might be something specific to your Acumatica instance. I will reach out privately.

Regards,

Gabriel
