Link to home
Start Free TrialLog in
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?
SOLUTION
Avatar of pernicek
pernicek
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ayngalt
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
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial