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

    Unanswered: subscript out of range error

    I have been struggling to fix this error. Just as I thought I fixed the problem the error pops up again. I really need some help.
    What I want is to verify the Dim and ReDim statements. Are they correct? Where do you think caused the error?

    Thank you for your assistance!!

    Here is my code:

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

    Public Sub Form_Open(Cancel As Integer)

    Me!shipping_sched_list_subform.SourceObject = "shipping_sched_list"
    ReDim display_fields(field_list_length - 1)
    ReDim field_list(field_list_length - 1)
    Call ..

    End Sub

    Sub initialize_display_fields()
    Dim i As Integer

    For i = 0 To field_list_length - 1
    display_fields(i) = "" 'display_fields begins w/ zero
    '''' ERROR OCCURRED HERE
    Next
    End Sub

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    You might get a quicker answer if this was posted in the VB section.
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    May 2002
    Posts
    395
    I apology I didn't supply all the necessary code.

    Here is my code:

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

    Public Sub Form_Open(Cancel As Integer)

    Me!shipping_sched_list_subform.SourceObject = "shipping_sched_list"
    ReDim display_fields(field_list_length - 1)
    ReDim field_list(field_list_length - 1)
    Call intialize_field_list
    Call prep_sched_input

    End Sub


    Sub intialize_field_list()

    field_list(0) = "work_ord_num"
    field_list(1) = "cust_name"
    : :
    field_list(24) = "work_ord_line_num"

    End Sub



    Sub prep_sched_input()
    On Error GoTo Err_prep_sched_input

    Call initialize_display_fields
    display_fields(0) = "work_ord_num"
    display_fields(1) = "cust_name"
    : :
    display_fields(17) = "work_ord_line_num"
    Call set_columns


    End Sub



    Sub initialize_display_fields()
    Dim i As Integer

    For i = 0 To field_list_length - 1
    display_fields(i) = "" 'display_fields begins w/ zero
    '''' ERROR OCCURRED HERE in display_fields array
    Next

    End Sub

    Thanks!!

Posting Permissions

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