Results 1 to 6 of 6

Thread: HElp Needed with Fixed Arrays???

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Posts
    103
    I have declared my fixed array in a module.bas file
    but when i try to run it i get an error "subscript out of
    range"
    run time error "9"
    any ideas what im doing wrong???

    Code:
    Option Explicit
    Public outSkillsData()
    then tried using my array called outskillsdata
    Code:
    Dim noData As Boolean
    
    noData = False
    On Local Error Resume Next
    If UBound(outSkillsData, 2) = 0 Then noData = True
    On Local Error GoTo 0
    help me what am i doing wrong?????




  2. #2
    Guest

    Your Error with Arrays

    Hi JohnnyBoy

    The problem is that the array is not declared correctly. If it is a fixed array it needs to have the length inside the brackets ie,

    Public outSkillsData(10)

    What you have done is declare a dynamic array. Using this technique you need to redim the array befor you use it, ie

    ReDim outSkillsData(10)

    Regards Robert

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Posts
    103

    robdehn

    oops you are right it is a dynamic array
    i have tried to redim the array but still come
    up with that error???
    any ideas on that one?????

  4. #4
    Guest

    robdehn's reply

    When do you get the error?
    I can both read and write to the redimed array!

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Posts
    103
    here it is i redimed it but the error occured at the same place?????

    Code:
    Function popEditSkills(theForm As Form) As Integer
    '****************************************************************
    '   Populate the skills part of the form with the valid skills
    '    from the database
    
    Dim i As Integer
    Dim j As Integer
    Dim theindex As Integer
    Dim tempDyna As Recordset
    Dim noData As Boolean
    ReDim outSkillsData(10)
    
    noData = False
    On Local Error Resume Next
    If UBound(outSkillsData, 2) = 0 Then noData = True
    On Local Error GoTo 0
    
    If noData Then
        
        'if outSkillsData is empty then this routine will fill the array from the database
        'and pop the outline at the same time
        With theForm.outSkills
            .Clear
            .AddItem "Technical"

  6. #6
    Lively Member
    Join Date
    Sep 2000
    Posts
    116

    Cool

    Try this and see if it works:

    Dim outSkillsData() As String
    0101011001000010
    01101111011011100110110001101001011011100110010101110010

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