Solved

Run time error 381

Posted on 2002-04-17
7
1,358 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 7

Expert Comment

by:Joe_Griffith
ID: 6948850
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
ID: 6948975
It appears like a problem with option base (0 or 1) but we need more details as joe saids.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 6949093
listening
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:sureshrao72
ID: 6949171
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
ID: 6949174
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
ID: 6949248
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
ID: 6949311
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

688 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