array error

Results 1 to 2 of 2

Thread: array error

  1. #1
    Join Date
    Dec 1969

    Default array error

    I&#039;m getting a "Subscript out of range error" when i pass an array value to a function that returns a boolean value:<BR><BR>For i = 0 To UBound(arrEmail)<BR> If ValidateEmail(arrEmail(i)) Then <BR> &#039;do something <BR> Else<BR> &#039;do something else<BR> End If<BR>Next<BR><BR>But if i do this, it works:<BR><BR>For i = 0 To UBound(arrEmail)<BR> &#039;do something else<BR>Next<BR><BR>I can&#039;t figure out why the if then statement is causing the subscript error. Anyone have an idea?

  2. #2
    Join Date
    Dec 1969

    Default What happens if... change the code to this:<BR><BR>&#060;%<BR>For i = 0 To UBound(arrEmail)<BR>&nbsp; &nbsp; temp = arrEmail(i)<BR>&nbsp; &nbsp; If ValidateEmail( temp ) Then <BR>&nbsp; &nbsp; &nbsp; &nbsp; &#039;do something <BR>&nbsp; &nbsp; Else<BR>&nbsp; &nbsp; &nbsp; &nbsp; &#039;do something else<BR>&nbsp; &nbsp; End If<BR>Next<BR>%&#062;<BR><BR>If the subscript error moves to the line where the value is assigned to temp, then something is *really* weird! [Unless, perhaps, the elements of the array are *object references*? Meaning you need SET temp= ... ?]<BR><BR>But if it stays on the IF line, then obviously the problem is not in the usage of the arrEmail array.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts