Avatar of ayngalt
ayngalt
 asked on

MS Access "Array Index Out of Bounds" Error

I have an Access application that we've been using for years.  One of things it does is looks in an Outlook folder and pulls any new files that have been copied to the folder.  Today we started getting an error "Array index out of bounds".  When I go to debug, it highlights the following line of code:

oMsg.Attachments.Item(1).SaveAsFile "C:\Faxes\" & TheFileName

Open in new window


Any ideas of how to work around this?
OutlookMicrosoft OfficeMicrosoft Access

Avatar of undefined
Last Comment
Patrick Matthews

8/22/2022 - Mon
SOLUTION
pernicek

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ayngalt

ASKER
As it turns out I looked in Outlook at the email that Access was looking at didn't contain an attachment.  I guess the first one in 7 years of using the application.  Possibly not having an attachment triggered the out of bounds in that it was looking for one and none was there?  Anyway, when I deleted the email without an attachment, everything started working again.
ASKER CERTIFIED SOLUTION
Patrick Matthews

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes