Solved

Run time error 381

Posted on 2002-04-17
7
1,352 Views
Last Modified: 2008-03-03
An application developed in VB6 runs perfect in Windows NT, Win2k, win98. But gives error "run-time error '381' - Invalid array index". when run on Windows XP Please suggest.
0
Comment
Question by:sureshrao72
7 Comments
 
LVL 7

Expert Comment

by:Joe_Griffith
Comment Utility
Your going to have to give more information to get an answer.  Can you post the code that is causing the problem?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
It appears like a problem with option base (0 or 1) but we need more details as joe saids.
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
listening
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:sureshrao72
Comment Utility
The Vb code is

Private Sub cboMdlSlsAreaCd_DropDown()
    MousePointer = Default      '041702
    SendKeys "{DOWN}", True
End Sub

The error occurs when definiting the Dropdownbox cboMdlSlsArea_Cd.
0
 

Author Comment

by:sureshrao72
Comment Utility
Forgot to mention. This happens only at run-time. This does'nt occur at design-time or debugg time.
0
 
LVL 3

Accepted Solution

by:
dannic earned 50 total points
Comment Utility
You can try to add linenumbers and errorhandler to your code!

Eg.
Private Sub cboMdlSlsAreaCd_DropDown()
   On Error GoTo cboMdlSlsAreaCd_DropDownErr
10
   MousePointer = Default      '041702
20
   SendKeys "{DOWN}", True
30
   Exit Sub
cboMdlSlsAreaCd_DropDownErr:
    Call App.LogEvent("ErrorNumber: " & Err.Number & vbCrLf & _
                       "ErrorSource: " & Err.Source & vbCrLf & _
                       "ErrorDescription: " & Err.Description & vbCrLf & _
                       "Error at line: " & Erl, vbLogEventTypeError)
'Raise error
Err.Raise Err.Number, Err.Source, Err.Description
End Sub

This will help you to locate the statement that make this runtime error.

To see the log you just have to look in the Application log with the Event Viewer.
(Start->Programs->Administrative Tools->Event Viewer)

Good luck
dannic

0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
In Click event of cboMdlSlsAreaCd you are using its ListIndex property without checking if anything is selected.  Am I right?
If yes, include line "If cboMdlSlsAreaCd.ListIndex > -1 Then" before the line which uses ListIndex.  
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now