Subscript out of range while checking on Array.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tomaz
    New Member
    • Oct 2008
    • 29

    Subscript out of range while checking on Array.

    i have an array for each mailbox. if i ask the array of mailbox 1,2,3,4... it returns a "1" if there are unread messages.
    If there are no unread messages i receive "". (empty)


    Yet, the moment I check it returns an error: "subscript out of range"

    How can I check if a value of an array is empty?



    If ArrUnreadMsg(AD ORstMailbox("Id tMailbox")) = "1" Then

    If it's "1", the loop works.
    If it's "", i get an error.


    The thing that happens behind the screen:

    If there are unread messages, a Redim Preserve is done with the mailboxnumber.
    so when there are no unread messages, the redim does not happen.

    Can I check if the array is filled in at a certain position?

    thanks
  • lakshmanmcaj
    New Member
    • Jul 2006
    • 35

    #2
    Try like this example


    j = 0
    Do While Not j > uBound(MyArray)
    Response.write( MyArray(j))
    j = j + 1
    Loop

    Comment

    Working...