Results 1 to 3 of 3

Thread: Subscript out of range: '[number: 1]'

  1. #1

    Thread Starter
    Addicted Member raptormanad's Avatar
    Join Date
    Oct 2008
    Posts
    224

    Subscript out of range: '[number: 1]'

    I keep getting this error:

    Code:
    Microsoft VBScript runtime (0x800A0009)
    Subscript out of range: '[number: 1]'
    /info.asp, line 79
    With this line of code:

    Code:
    IF (lCase(cStr(fileextension(1))) <> "jpg") AND (lCase(cStr(fileextension(1))) <> "jpeg") AND (lCase(cStr(fileextension(1))) <> "gif") THEN
    Can someone please explain why? Thanks!

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Subscript out of range: '[number: 1]'

    That error is one of the ones covered in the article What does this error mean, and how do I fix it? from our Classic VB FAQs (in the FAQ forum)

    In this particular case, it seems that fileextension hasn't got an element 1, but without seeing more code we cannot tell why that might be

  3. #3

    Thread Starter
    Addicted Member raptormanad's Avatar
    Join Date
    Oct 2008
    Posts
    224

    Re: Subscript out of range: '[number: 1]'

    The code wasn't checking the field for being blank so I just added an IF statement. That worked. Thanks for the references and explanation!

Posting Permissions

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



Click Here to Expand Forum to Full Width