"subscript out of range" 
Author Message
 "subscript out of range"

arr_lijn appears to not be defined as an array



Tue, 22 Apr 2003 03:00:00 GMT  
 "subscript out of range"
This one loops through a text-file and picks info line by line out of it,
but when it has read all of the lines the following error occurs on: Select
Case arr_lijn(0)

"subscript out of range"
So, I ask of you: What's wrong?

        For Each file In files

            Open padnaam & objAttachment For Input Access Read Lock Read As
#1

                Do While Not EOF(1)   ' Loop until end of file.

                    str_lijn = ""

                    'Lees de variabelen uit het bestand
                    Line Input #1, str_lijn

                    arr_lijn = Split(str_lijn, "=")

                    Select Case arr_lijn(0)
                        Case "e-mailadres="
                            str_emailadres = arr_lijn(1)
                        Case "omschrijving="
                            str_omschrijving = arr_lijn(1)
                        Case "TijdstipIn="
                            str_tijd = arr_lijn(1)
                        Case "Intaker_klant="
                            str_intaker_klant = arr_lijn(1)
                        Case "statusid="
                            str_statusid = arr_lijn(1)
                        Case "datumin="
                            str_datumin = arr_lijn(1)
                    End Select

                    Loop
             Close #1                    'Bestand afsluiten

       MsgBox "Uw database is geupdated", vbInformation

        file.Delete
    Next



Tue, 22 Apr 2003 18:18:20 GMT  
 "subscript out of range"

Quote:
> This one loops through a text-file and picks info line by line out of it,
> but when it has read all of the lines the following error occurs on:
Select
> Case arr_lijn(0)
>                     arr_lijn = Split(str_lijn, "=")

>                     Select Case arr_lijn(0)

Sounds like the Split function is returning an empty array (no elements or
data).  Try catching the error and messaging str_lijn and arr_lijn to see
exactly what's going on.

Royston



Tue, 22 Apr 2003 22:50:55 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. "subscript out of range" - Excel

2. "Subscript out of range Error"

3. "Subscript out of Range" error message

4. Undo "Range"?

5. HELP with .Bookmarks("variable").Range.InsertFile

6. Selection.Sort Key1:=Range("??")

7. Selection.Sort Key1:=Range("???")

8. Selection.Sort Key1:=Range("???")

9. "Subscirpt out of range error"

10. "Fetch type out of range" error

11. *"*-.,._,.-*"* I"LL TRADE VISUAL C++ FOR VBASIC *"*-.,_,.-*"*

12. access 2000 "subscript out of range" error PLZ HELP!!!

 

 
Powered by phpBB® Forum Software