Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Posts
    395

    Unanswered: subscript out of range

    I received the error message above when I try to initialize the fields with a blank value in an array. Can anyone tell me why and how I can fix this.

    Thank you.


    Dim field_list() As String
    Dim display_fields() As String
    Const field_list_length As Integer = 24


    Sub initialize_display_fields()
    Dim i As Integer

    For i = 0 To field_list_length
    display_fields(i) = ""
    '''''' Error occurred here
    '''' display_fields(i)=<Subscript out of range>

    Next
    End Sub

  2. #2
    Join Date
    May 2003
    Posts
    3

    Re: subscript out of range

    I think you need
    Redim field_list(field_list_length)
    before you initialise.
    Your array as Dimmed has no dimensions!


    Originally posted by alicejwz
    I received the error message above when I try to initialize the fields with a blank value in an array. Can anyone tell me why and how I can fix this.

    Thank you.


    Dim field_list() As String
    Dim display_fields() As String
    Const field_list_length As Integer = 24


    Sub initialize_display_fields()
    Dim i As Integer

    For i = 0 To field_list_length
    display_fields(i) = ""
    '''''' Error occurred here
    '''' display_fields(i)=<Subscript out of range>

    Next
    End Sub

Posting Permissions

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