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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array Index Out of Bounds

Status
Not open for further replies.

OrbitMascot

Programmer
Jan 23, 2006
30
US
I am working with an automated ordering system. Shops place their orders via email, and the database breaks the orders down. The database is always running, but every couple of days I get an error stating "Array Index Out of Bounds" and it stops the automated system. I have included an Error trap so I am not sure why the error stops the database. Any assistance would be greatly appreciated.

Thanks,
OrbitMascot

Below is the beginning and ending code.

On Error GoTo Stop_Crash

iCount = molItems.Count
For i = 1 To iCount
If TypeName(molItems(i)) = "MailItem" Then '''''' Error highlights this line.
'run procedure
End If

Forms!Main.TimerInterval = 60000
DoCmd.Close acForm, "Automated", acSaveYes

Exit Sub

Stop_Crash:
Forms!Main.TimerInterval = 60000
DoCmd.Close acForm, "Automated", acSaveYes

End Sub

 
A starting point:
Set molItems = molMAPI.Items
For Each myItem In molItems
If TypeName(myItem) = "MailItem" Then
If myItem.SenderName Like "Store*" And myItem.Body Like "*Qty*" Then
' your stuff here
End If
End If
Next

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I just wanted to thank you guys for all your help and let you know that the database is working great. Thank you for all your help.

Orbitmascot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top