Runtime Error 9 in VB App

i have a VB6 program, which imports data from text files into a MS SQL DB.
i can run this program from inside vb6 on any computer without an error.
if i compile the exe and run it on Windows Server 2003, it  stops with "Runtime Error 9" end ends.
how can i find, which code is causing the error?
or is it an OS issue or something else?
LVL 11
WeHeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carl TawnSystems and Integration DeveloperCommented:
Its quite possibly a Server 2003 related issue.  There are lots of changes/new features in 2003 that can effect the way some things work.  

Error number 9 is "Subscript out of range", so you need to start by looking at anywhere in your app that you use arrays (specifically looping through arrays)

Hope this helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GrahamSkanRetiredCommented:
Subscript out of range is a common run-time error.

It could mean that you are now using external data to index an array, and that the number is not what was expected.

If you are certain that  you are always testing your data for sanity, then I suggest a trace log. There is a logging facility in VB, but it doesn't work in design mode, so I use a simple procedure. It starts a new one each day for easier management.

Sub WriteLog(Text As String)
    Dim f As Integer
    Dim strFileName As String
    strFileName = "abc" & Format$(Now, "MMy") & ".log"
    Text = Format$(Now, "HH:nn:ss") & " " & Text
    Debug.Print Text
    f = FreeFile
    Open App.Path & "\" & strFileName For Append As #f
        Print #f, Text
    Close #f
End Sub

As a start, try putting calls in at the top of each sub and function. That way you'll narrow it to down to a particular procedure.

e.g.

Sub MyProc(Par1 as string)
Dim....

Writelog "Procedure: MyProc. Parameter Par1=" & Par1

...
End Sub
0
fds_fatboyCommented:
It could be that the app cannot find the text files on the server machine or a file is empty. My guess is that it loads arrays when processing the files and then in turn loops through the arrays processing them.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Mikal613Commented:
please post code
0
WeHeAuthor Commented:
When i have found the part, where the error is caused, i will post it.
atm i have to work on our wins for a while.
0
WeHeAuthor Commented:
i don't know why, but now the app is running without any error.
thank you for your comments
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.