Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Run Time Error '381' Invalid Property Array Index

Alright, I tried to look this error up on the Microsoft webiste and couldn't find anything. Anyone know anything about this error. The reason I am concerned, is that I put an error handling to do certain things for certain errors, and for any other errors, its supposed to create an error log and not kick the user out of the program. But this error came up and kicked the user out, any ideas?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Invalid Property Array Index Error
Private Sub cmdSearch_Click()

Dim strAisle(0 To 5) As String
Dim intIndex As Integer
Dim i As Integer

' this is the problem , why?
intIndex = lstCategories.ItemData(lstCategories.ListIndex)

For i = 0 To lstCategories.ListCount - 1

strAisle(0) = "Aisle 1"
strAisle(1) = "Aisle 2"
strAisle(2) = "Aisle 3"
strAisle(3) = "Aisle 4"
strAisle(4) = "Aisle 5"
strAisle(5) = "Back Wall"

Next i

If intIndex <> -1 Then
lblAisle.Caption = strAisle(intIndex)
MsgBox "Make a selection"
End If

End Sub
I am getting an "Invalid property array index' error.
Noted above is the problem line.
Works fine without *.ItemData, however, I need to implement it for when the list box gets sorted. (keep the same value) because *.ListIndex keeps the same position of the array.

Error :invalid Property Array Index
Any ideas why this error is popping up when the first part (exactly the same except for the control name) works fine?

Public Sub fill_in(Frm As Form)
Dim i As Long
Dim E As Boolean

' Fill in Object Name & QTY
FN = Frm.Name

If FN = "FrmTubs" Then i = 0
If FN = "FrmSurround" Then i = 1
If FN = "FrmFixtures" Then i = 2
With FrmLiner

.Label1(i).Caption = Frm.Combo1.Text
.Label3(i).Caption = Frm.Text1.Text
End With
' Fill in list cost
If i = 0 Then
With FrmTubs.Combo1
FrmLiner.Label11(i).Caption = Format(.ItemData(.ListIndex), "$#,##0.00")
End With
With FrmTubs
i = .Combo1.ListIndex
FrmLiner.LblTotals(1).Caption = Format(.Combo1.ItemData(i) * .Text1.Text, "$#,##0.00")
End With
End If

If i = 1 Then
With FrmSurround.Combo1
FrmLiner.Label11(i).Caption = Format(.ItemData(.ListIndex), "$#,##0.00") End With
With FrmSurround
i = .Combo1.ListIndex
FrmLiner.LblTotals(1).Caption = Format(.Combo1.ItemData(i) * .Text1.Text, "$#,##0.00")
End With
End If

End Sub

then red code is what is highlighted when debugged and the .ItemData seems to be where the error comes from

Invalid Property Array Index
Dim i As Integer

Set j_ObjCom = New ADODB.Command
With j_ObjCom
.ActiveConnection = j_Objcn
.CommandText = "Select * from vieMatrixcolor where Style = '" & cboStyle.Text & "'"
End With

Set j_Objrs = New ADODB.Recordset
With j_Objrs
.ActiveConnection = j_Objcn
.CursorLocation = adUseClient
.CursorType = openstatic
.Open j_ObjCom

End With

For i = 1 To j_Objrs.RecordCount - 1
'error stops on this line
vsfMatrix.TextMatrix(i, 0) = Trim(j_Objrs("Color").Value)

it shows the first color then it stops at that line

Invalid Property Array Index
I am trying to populate the itemdata of a list box, when debugging i notice that the code:-

LstMake.ItemData(LstMake.ListCount - 1) = recordset.Fields(0)

is highlighted and vb tells me that there is an invalid property array index,
can anyone see any error here??
or do i need to post you more code to understand the problem?

Invalid Property Array Index
Please help me with this code, I keep getting (invalid property array index) error .

VB Code:
Private Sub Get_All_Drives()On Error GoTo ErrHand     Dim sDriveName As String    sDriveName = String$(1, 0) 'Declare a Single length string        sDriveName = "A"    lstDrive.Clear   For i = 0 To 25        Select Case GetDriveType(sDriveName & ":")            'Case DRIVE_UNKNOWN             'Case DRIVE_DOES_NOT_EXIST                            Case DRIVE_REMOVABLE                lstDrive.AddItem (sDriveName) & vbTab & "-" & vbTab & "Floppy Drive"            Case DRIVE_FIXED                lstDrive.AddItem (sDriveName) & vbTab & "-" & vbTab & "Hard Disk Drive"            'Case DRIVE_REMOTE                       Case DRIVE_CDROM                lstDrive.AddItem (sDriveName) & vbTab & "-" & vbTab & "CD-ROM Drive"                            'Case DRIVE_RAMDISK                    End Select        lstDrive.Selected(lstDrive.ListCount - 1) = True        sDriveName = Chr(Asc(sDriveName) + 1)    Next        Calc_Hidden_Drives     lstDrive.ListIndex = 0Exit SubErrHand:    MsgBox "Error Occurred while Retrieving Drive Details !!" & vbCrLf & "Procedure : Get_All_Drives " & vbCrLf & err.Description, vbCriticalEnd Sub

Invalid Property Array Index
lstWoord is a list and I want to remove all the selected items.
Why does this code don't work ?

For i = 0 To (lstWoord.ListCount - 1)
If lstWoord.Selected(i) Then lstWoord.RemoveItem (i)
Next i

Invalid Property Array Index
I need to get rid of this error:

Run-Time error 381:
Invalid Property Array Index

This is the code that is generating it:

Private Sub List1_Click()

Dim z As Integer
For z = 0 To File1.ListCount
File1.Selected(z) = False

End Sub

When I debug this part is highlighted:
File1.Selected(z) = False

The same error occurs when I change
Dim z As Integer to Dim z

I am going to continue trying to fix this, but any help will be appreciated!

Invalid Property Array Index
I am populating a drop down box and storing also adding an index.

I have added code for auto text complete in the item click event so if users start typing a word it will look to see if that value exists and selects it. If users use this feature I get the "Invalid Property array index" when I go through my save process...

Here is the code that errors out.
Code:intTypeID = cboType.ItemData(cboType.ListIndex)

It is almost like no click_Event was invoked. If user just select from the drop down I have no problems at all. Anyone have any ideas here for me?

Here is my auto complete code...

Code:strCurText = LCase(cboType.Text) 'Text Autocomplete Procedure
intCurTextLen = Len(strCurText)
If intCurTextLen - intOldTextLen = 1 Or (intCurTextLen = 1 And intCurTextLen > intOldTextLen) Then
   For intCounter = 0 To cboType.ListCount
     If strCurText = LCase(Left(cboType.List(intCounter), intCurTextLen)) Then
        Exit For
      End If

If intCounter <= cboType.ListCount And strCurText <> "" Then

For intLoopCtr = 0 To cboType.ListCount
    If cboType.List(intLoopCtr) = cboType.List(intCounter) Then
       Exit For
     End If

cboType.ListIndex = intLoopCtr
cboType.SelStart = intCurTextLen
cboType.SelLength = Len(cboType.Text) - intCurTextLen
End If
End If
intOldTextLen = intCurTextLen

Edited by - Adobe on 3/19/2007 5:58:55 AM

Run-time Error 380 - Invalid Property Value
I am having issues with a checkbox. I have designed a form in VB 6.0. I have several check boxes on this form and am writing the result to a bit field in a SQL DB. However, when I attempt to retreive the data from the DB to the form and display the information I am receiving a run-time 380 error.

I have been unable to find any property mismatch.

Any suggestions?

Run-time Error 380 - Invalid Property Value
Set cboSupplier.DataSource = SupplierRS
Set cboSupplier.RowSource = SupplierRS

With cboSupplier
.BoundColumn = "SupplierNo"
.DataField = "CompanyName"
.ListField = "CompanyName"
End With
When I run my application I keep getting:
Run-time error 380 - Invalid property value
The line the error occurs on is .BoundColumn = "SupplierNo". SupplierNo is the primary key in that table.

The reason I need the .boundcolumn value is I am later saving the SupplierNo of the selected Supplier to a grid.

grdSupp.Text = cboSupplier.BoundText

Run-time Error '380': Invalid Property Value
before nothing i'm sorry about my english, i'm learning about it; i have an aplication, when i execute the first thing i see is the error in subject but im very confused because the error is only in any computers, in others the aplication executes properly

can anybody help my about the reason this problem?

thanks a lot!

Run-time Error: 380 - Invalid Property Value.
Good morning everybody:

I am attempting to populate a listview control on Form Load()
and I get a Run-Time Error: 380 - Invalid property value. Below is the line that generated the error:

lvw.ListItems(lvw.ListItems.Count).SubItems(1) = OutlookAddressEntry.Address

Below is also my entire FormLoad module:


Private Sub Form_Load()
Set OutlookApp = New Outlook.Application
Set OutlookMailItem = OutlookApp.CreateItem(olMailItem)
Set OutlookNameSpace = OutlookApp.GetNamespace("MAPI")


For Each OutlookAddressList In OutlookNameSpace.AddressLists
For Each OutlookAddressEntry In OutlookAddressList.AddressEntries
lvw.ListItems.Add , , OutlookAddressEntry.Name
lvw.ListItems(lvw.ListItems.Count).SubItems(1) = OutlookAddressEntry.Address
lvw.ListItems(lvw.ListItems.Count).SubItems(2) = OutlookAddressEntry.ID
lvw.ListItems(lvw.ListItems.Count).Tag = OutlookAddressEntry.ID
End Sub

Any help will b greatly appreciated

Runtime Error 381 Invalid Property Array..
i'm trying to add some values to a list box... i can step through the code and it seems to work okay at first but then i get an error.

"Runtime Error 381 Invalid Property Array.."
any ideas???

the value for !ID = 44369 when it errors out

If .RecordCount <> 0 Then
.Sort = "OEMPN ASC"
Do Until .EOF
lstStructure(12).AddItem !OEMPN
lstStructure(12).ItemData(lstStructure(12).NewIndex) = !Id
End If
the value for !ID = 44369

MSHFlexGrid: Run-time Error '380' Invalid Property Value
I have a mshFlexGrid control with 18 columns and a variable number of rows. I use it to display and sort small sets of data.

I have run about 30 data sets through the process sorting on 10 columns. I consistently get an error which does not make any sense to me.

It always occurs on the same data set and always the same column.

The error occurs on this line:
mshDet.Sort = flexSortNumericAscending
The .ColSel and .Col values are equal, the .RowSel and .Row are also equal.

On the data set causing the error, I noted that it contained duplicate values [161.7]. Other columns have contained duplicate values and not caused the error but this is the only one I noted which contained a fractional value, i.e., other duplicates were integers. I made sure the numeric entry did not contain any leading spaces which I thought might confuse the determination of a character and numeric field and the error still occurred.

On a WAG, I broke into the code loading the grid and changed one of those values so the duplication did not occur. The error did not occur when the duplication was removed.

I then changed the line of code to:
mshDet.Sort = flexSortGenericAscending
and the error no longer occurs.

I am thoroughly baffled! Can anyone offer an explanation as to the cause of the error?

Run-time Error 380 Invalid Property Value With ListBox For Loop
I'm using Visual Basic 6.

Okay, what im trying to do is have a ListBox's ListIndex loop, like this:

For I = 1 To 100
ListBox.ListIndex = -1 + I
Next I

As soon as it gets around to doing this function, I get "run-time error 380: Invalid property value". I've tried ListBox.ListIndex = I, ListBox.ListIndex = 0 & I, ListBox.ListIndex = 0 + I, everything. If anyone could help me fix that I would greatly appreciate it. OR, if there is another way to change the listindex through a loop or something that you know works, you can share it too Still kinda new to this.

Invalid Printer Index (6) Error
I have some VB code that uses a 3rd party COM object to print reports.

My customer has reported this error has started to happen.

I am awaiting a call back from the 3rd part COM provider to see if it is something to do with this.

I have Googled this error but it does not return anything.

I wondered whether it was a print driver thing but my customer assures me they have output other stuff to the printer OK.

Has anyone else come across this message before?

Thanks in advance

No Index Property In RTF Control Array
I tried to find some information on this but a search on "rich text control array" does not return anything related. basicaly intelisense gives me item,count,ubound and lbound for my RTF array no index! The funny thing is if I double click it in IDE it gives me an index for the click event. Any suggestions ?

String As Index In A Property Array
Is it possible to index a property array with a string instead of a integer?
I've tried but I can't get it to work.
What I had in mind was something like this:

Public Property Let Matrix(Index As String, newMatrix As Variant)
mIMatrix(Index) = newMatrix
End Property
Public Property Get Matrix(Index As String) As Variant
Matrix = mIMatrix(Index)
End Property

Control Array Index Property
I have an assignment that has a control array of command buttons representing the seating plan of an aeroplane. How do I reference the index property of the control array from another form that is displayed once the command button is pressed?
I need this index property so I can calculate the position of the command button to store information in a corresponding 2D array. The control array is 4 cols by 8 rows. I know I have to use row=IndexNumber 4+1 and col=IndexNumber MOD 4+1. Any help appreciated. Sandra

Runtime Error:operation Invalid Without A Current Index.
Can anyone help me with this problem i'm having.
When I execute the following, I keep getting a run time error "-2147467259", which says "operation invalid without a current index". I have tried repairing and compacting the database (Access97) but this did not solve the problem.

SQL = " INSERT INTO [TAT SUB COMPLETED] ([Month], OrderNo, PartNumber, WorkshopNumber, RefurbNo, ShelfLocation, PurchaseOrder, DateIssue, DateIn, FromDate, DateOut, DateStamp, CompletedDate, TAT, [TAT in Calendar Days], ProposedTAT, Diff, TATStatus, Location, ShipmentNumber, JobLocation)
SELECT Format([DateOut],'yyyymm') AS [Month], tblFinishedGoods.OrderNo, tblFinishedGoods.PartNumber, tblFinishedGoods.WorkshopNumber, tblFinishedGoods.RefurbNo, .................................

DBMeasurements.Execute SQL


Invalid Bands Collection Index Runtime Error 2007 ???
Hi there, I get this error in my application ! What causes this ? And how can I fix it ?


Create Package Error; "Unexpected Error Number 380 Has Occured;invalid Property Value
Hi all,

I try to create a package in visual basic; However, I found the following error. "Unexpected error number380 has occured; Invalid property value". My development environment ,
OS: Win2000
VB: Visual Basic 6.0

Thanks a lot .

Edward Hui

Invalid Property Value Error
My application works fine on my computer upon which is intalled VB6. I installed the application on another computer and most of the app works fine but, i get error 380 invalid property value when trying to print stuff.

My probleme is that i cant reproduce this behavior on my computer. So i have no idea where in the code that the error occures.

I am assuming it has something to do with MDAC version or something similar...

Any idea on how to troubleshoot?

Invalid Property Value Error?
hey guys I have an update program that does this..

VB Code:
'OnResponseStart when you can safely access the headers.'OnResponseDataAvailable which returns a byte array of downloaded data for each chunk.'OnResponseEnd which ends the download.  Option Explicit'' Code for opening webpages ''Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ByVal hwnd As Long, _ByVal lpOperation As String, _ByVal lpFile As String, _ByVal lpParameters As String, _ByVal lpDirectory As String,          Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long      Private Declare Function ReplaceFileW Lib "Kernel32.dll" (ByVal lpReplacedFileName As Long, ByVal lpReplacementFileName As Long, ByVal lpBackupFileName As Long, ByVal dwReplaceFlags As Long, ByVal lpExclude As Long, ByVal lpReserved As Long) As Boolean  Public Sub FillCombo(objComboBox As ListBox, _                        oConn As ADODB.Connection, _                        strSQL As String, _                        strFieldToShow As String, _                        Optional strFieldForItemData As String)             Dim oRS As ADODB.Recordset  'Load the data              Set oRS = New ADODB.Recordset              oRS.Open strSQL, oConn, adOpenForwardOnly, adLockReadOnly, adCmdText              With objComboBox          'Fill the combo box                .Clear                If strFieldForItemData = "" Then                  Do While Not oRS.EOF      '(without ItemData)                    .AddItem oRS.Fields(strFieldToShow).Value                  oRS.MoveNext                  Loop                Else                  Do While Not oRS.EOF      '(with ItemData)                    .AddItem oRS.Fields(strFieldToShow).Value                     .ItemData(.NewIndex) = oRS.Fields(strFieldForItemData).Value             oRS.MoveNext                  Loop                End If              End With              oRS.Close                 'Tidy up              Set oRS = Nothing          End Sub      Public Function ReplaceFile(ByVal lpReplacedFileName As String, ByVal lpReplacementFileName As String, ByVal lpBackupFileName As String) As Boolean       'If lpBackupFileName parameter is NULL,       'no backup file is created.        Const REPLACEFILE_WRITE_THROUGH& = &H1       ReplaceFile = ReplaceFileW(StrPtr(lpReplacedFileName), StrPtr(lpReplacementFileName), StrPtr(lpBackupFileName), REPLACEFILE_WRITE_THROUGH, ByVal 0&, ByVal 0&)          End Function Private Sub httCheckVersion_OnResponseStart(ByVal Status As Long, ByVal ContentType As String)   If Status <> 200 Then     MsgBox "Remote file not found", vbExclamation + vbOKOnly          httCheckVersion.Abort     Set httCheckVersion = Nothing   End If        End Sub Private Sub httCheckVersion_OnResponseDataAvailable(Data() As Byte) Dim remotetext As String  remotetext = httCheckVersion.ResponseText  txtServer = remotetext  Set httCheckVersion = Nothing         Exit Sub         End SubPrivate Sub CheckForUpdates()Dim RemoteTextFile As String RemoteTextFile = ""      Set httCheckVersion = New WinHttpRequest        Dim sDownloadURL As String        httCheckVersion.SetTimeouts 25000, 25000, 250000, 250000               sDownloadURL = RemoteTextFile        httCheckVersion.Open "GET", sDownloadURL, True  'True means asynch.        httCheckVersion.send             End Sub      Private Sub ReplaceExeInUse()      Dim FileToUpdate As String      Dim FileBackUpName As String      FileToUpdate = App.path & "DatabaseMain1.mdb"      FileBackUpName = App.path & "DatabaseMain1.backup"      Dim result As Long      Call ReplaceFile(FileToUpdate, App.path & " mpDatabaseMain1.mdb.", FileBackUpName)      result = ShellExecute(Me.hwnd, "open", FileToUpdate, "/updaterestart " & GetCurrentProcessId(), "", 1)      End       End Sub            Private Sub Command1_Click()Text2.Text = "Connecting to Update Service."Text2.Text = Text2.Text & vbNewLine & "Beginning Updates..."Text2.Text = Text2.Text & vbNewLine & "Downloading Latest Live Help Server IP address..."  CheckForUpdates        Open App.path & "ServerIP.txt" For Output As #1Close #1 Open App.path & "ServerIP.txt" For Append As #1        Write #1, txtServer.Text        Close #1     Text2.Text = Text2.Text & vbNewLine & "Downloading Latest Live Help Server IP address...  DONE!"              Text2.Text = Text2.Text & vbNewLine & "Downloading Latest Antivirus / Antispyware Defininition Updates..." ' Create the WinHTTPRequest ActiveX Object.Set http = New WinHttpRequest' Open an HTTP connection.http.Open "GET", "", True 'True means asynch. ' Send the HTTP Request.     http.sendText3.Text = "On"  End Sub Private Sub Command2_Click()Unload UpdaterEnd Sub Private Sub Command3_Click()Set WinHttpRequest2 = New WinHttpRequest WinHttpRequest2.Open "GET", "", True WinHttpRequest2.send  End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If Text3.Text = "ON" Then http.AbortEnd If'httCheckVersion.Abort'http.Abort'WinHttpRequest2.Abort  'Unload Command1List2.ClearText2.Text = ""Unload UpdaterEnd Sub Private Sub http_OnResponseDataAvailable(Data() As Byte)mProgress = mProgress + UBound(Data) + 1ProgressBar1.Value = mProgress Put #1, , Data  End Sub Private Sub http_OnResponseFinished()Close #1'MsgBox "Updated database downloaded and installed! Please restart the program  for updates to take affect."Text2.Text = Text2.Text & vbNewLine & "Downloading Latest Antivirus / Antispyware Defininition Updates... DONE!"Text2.Text = Text2.Text & vbNewLine & "Please restart the program for the updates to take affect." PlaySound App.path & "databasedlok.WAV", ByVal 0&, SND_FILENAME Or SND_ASYNC Antivirus.Text10.Text = Antivirus.Text10.Text & vbNewLine & "Updated database downloaded and installed! Please restart the program  for updates to take affect."End Sub Private Sub http_OnResponseStart(ByVal Status As Long, ByVal ContentType As String)Text1.Text = http.GetAllResponseHeaders()mProgress = 0mContentLength = CLng(http.GetResponseHeader("Content-Length")) ProgressBar1.Max = mContentLengthOpen App.path & "DatabaseMain12.mdb" For Binary As #1 End Sub Private Sub Label3_Click()ShellExecute Me.hwnd, "open", "", vbNullString, vbNullString, ByVal 1&End Sub Private Sub WinHttpRequest2_OnResponseDataAvailable(Data() As Byte) mProgress = mProgress + UBound(Data) + 1 ProgressBar1.Value = mProgress Put #1, , Data 'This holds your file End Sub Private Sub WinHttpRequest2_OnResponseFinished() Close #1 MsgBox "Updated Server IP downloaded and installed! Please restart the program  for updates to take affect."Text3.Text = "OFF" End Sub Private Sub Form_Load()Label9 = FileDateTime(App.path & "DatabaseMain12.mdb") Label10 = Format(FileLen(App.path & "DatabaseMain12.mdb") / 1024, "#,### KB")Dim con As ADODB.ConnectionDim strSQL As StringDim strCol As StringSet con = New ADODB.Connectioncon.CursorLocation = adUseClientcon.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.path & "DatabaseMain12.mdb;" & "Jet OLEDB:Database Password=omegacron2;"strSQL = "SELECT * FROM table1"strCol = "viruslist"Call FillCombo(List2, con, strSQL, strCol)con.CloseSet con = Nothing Label7.Caption = " " & List2.ListCount   End Sub   Private Sub mnuclose_Click() Unload UpdaterEnd Sub

Now the prog works, it downloads files and what not, but when I am in the middle of a download and I exit the updater I get the error "invalid proeprty value and it highlights the code....

ProgressBar1.Value = mProgress

in the code...

VB Code:
Private Sub http_OnResponseDataAvailable(Data() As Byte)mProgress = mProgress + UBound(Data) + 1ProgressBar1.Value = mProgress Put #1, , Data  End Sub

Anyone know how I may fix this bizarre thing?

Error 380 Invalid Property Value

In my app the user clicks on a line in a list box and this manipulates the text in a RTB. The code for this is all in the mouse_up event.

The RTB is the only thing that get properties manipulated. The propertires that it works with are:


And the Find method.

Now for the wierd part. For a couple of users (2 of 15) when they click on a line in the list box they get an error 380 invalid property value. But it's not all of the lines. In the one case with 48 lines in the list box it happens on lines 4 - 19. The only lines that do anything different are the first and the last so they should all show the error and not just a few.

I've been unable to reproduce the error on any of my machines. And these users are a fair distance from me so going there to troubleshoot on sight is not really in the cards.

So, I guess what I'm asking is: Does anyone have any Ideas for some error traping that will help me identify where the error is ocurring? I tried err.source but it just gives me the name of my project. If there were a way to get a line number that would be ideal.

Or does anyone have any ideas what is causing this?



Invalid Use Of Property Error
I am using the following code to allow users to enter the first letter of a list of items in dropdown boxes and have the box populate:

VB Code:
Dim txtTmpValue    txtTmpValue = cboDrugType_r.Text    'Auto populates the value of the combo box by the first letter entered.    Select Case txtTmpValue        Case "G"            cboDrugType_r.Text = "Generic"        Case "B"            cboDrugType_r.Text = "Brand Formulary"        Case "N"            cboDrugType_r.Text "Brand Non-Formulary"        Case "g"            cboDrugType_r.Text = "Generic"        Case "b"            cboDrugType_r.Text = "Brand Formulary"        Case "n"            cboDrugType_r.Text "Brand Non-Formulary"    End Select

I've used this same procedure many times, but this time it's giving me an Invalid Use of Property error and highlighting the "Case N" line. Does anyone know why?

DTPicker - Error: Invalid Property Value
I have customized a DTPicker control. If I choose some dates in the control it is giving an error stating "Invalid property value". Not able to get the cause for this error. Help needed!!!

Progress Bar Error '380' Invalid Property Value
i've managed to implement the progress bar almost fully. it looks like it loads all the way to the top, but before it gets to the Max value it gives me the error 380 Invalid property value.

heres the code i'm using:

iFileNum = FreeFile
Open path For Input As iFileNum
Progress.ProgressBar.Max = LOF(iFileNum)
Progress.Label1.Caption = "Opening: " & path
Do While Not EOF(iFileNum)
Line Input #iFileNum, LineIn
'Debug.Print LineIn
If Progress.ProgressBar.Value < Progress.ProgressBar.Max Then
Progress.ProgressBar.Value = Progress.ProgressBar.Value + Loc(iFileNum) 'its this line that gives the error
End If
'code carries on after this with no problem

ok, when the error shows up, the values are:

Progress.ProgressBar.Value is 79001
Progress.ProgressBar.Max is 79225

all the loading code is fine its just since i've added this that it highlights the line with the error, its not reached its Max value yet but the progress bar looks full (probably because its such a high number) and it doesnt want to work, it hasnt reached the end of the file yet either.

Timer For 5 Min Error: Invalid Use Of Property
Hey how to set a timer for 5 min?
because when i put in 300000mili sec it say's:

Invalid Use Of property


Compile Error : Invalid Use Of Property
For the following code:

VB Code:
Private Sub cmdChangeSound_Click()Dim WaveFilecd3.Filter "WAV files(*.wav) | *.wav"cd3.ShowOpenIf cd3.filename = "" Then    WaveFile = App.Path & "/beep.wav"Else    WaveFile = cd3.filenameEnd If end sub

and i got the error: "Complie Error: Invalide use of property"

can anyone tell me why???


Invalid Property Value (Error 380) - HELLLPP!
I have an app that works fine but today I installed in a machine (IBM, Win95 with out IE), and I got this error in every window with data input. I installed DCom95, MDAC Vs. 2.1 and IE5 and this error persist.

Some can suggest me what to do?


I getting bored with Microsoft/ Windows/ Visual Basic! I installed my app as demo in 4 machines, this last week (and today) and I got 4 diferents errors!!!!!

Some one knows a VBLinux?

Thanks in advance.

Please Help Runtime Error 380 Invalid Property Value
I am using FileSystemObject to change the long names of the dbf files to 8.3 names and then back to the previous names. The code works fine for some files and after processing 10 or 11 files gives an error invalid property value. I am using DAO in the program to convert dbf to Access and to Excel formats.
Somebody please help me in this.
The part of the code in which i get error is:
'Alldata is the table in MS-Access database
Set daoTempRst = destdb.OpenRecordset("select count(*) from alldata")
            iTot = daoTempRst.Fields(0) - iTot
            If iTot = 0 Then
                If readAny = True Then Else readAny = False
                readAny = True
            End If
            If iTot <> 0 Then
            frmErrorListConv.rtf1.Text = frmErrorListConv.rtf1.Text & Chr(13) & "Reading file " & FoundFile & "." & Chr(13) & Space(4) & " Records read " & iTot
            frmErrorListConv.rtf1.Text = frmErrorListConv.rtf1.Text & Chr(13) & "Reading file " & FoundFile & "." & Chr(13) & Space(4) & " Records read " & iTot & "Reason: The file already exists."
            End If
             If Err.Number = 0 Then sFlagToAccess = CompletedSuccess
            Dialog.pb1.Value = Dialog.pb1.Value + 1
           spath = txtPath & ""
        fsoMove.MoveFile spath & convFile & ".dbf", spath & FoundFile

Thanks in advance

Runtime Error 380 - Invalid Property Value

I have a private sub called Vullistview. When i load my program, this sub is called, and a listview is loaded with some data from an access file. No problem.

I also want to call this sub when an user clicks an a tabstrip. So i call the sub again, and then i get this error.

This is the sub :


Private Sub Vullistview()
Dim liRes As ListItem

Set adoRs.ActiveConnection = adoCn
With adoRs
.LockType = adLockReadOnly
.CursorType = adOpenKeyset
.Open "select * from tblBuizen"
End With
Do While Not adoRs.EOF
Set liRes = frmNoroCat.lvRes.ListItems.Add(, , adoRs!ArtNr)
liRes.SubItems(1) = adoRs!DN
liRes.SubItems(2) = adoRs!Lengte
liRes.SubItems(3) = adoRs!wanddikte
liRes.SubItems(4) = adoRs!Materiaal

End Sub

When debugging, the error proints to the line : leRes.Subitems(1) = adoRs!DN

Compile Error: Invalid Use Of Property ?? --&gt; HELP!
Hello all,

I have a winsock object on a form, and when I try to do a connection to it I get this error:

Compile error: Invalid use of property

The "Load" word is highlighted in this code:

Private Sub tcpServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
Dim message_buffer As String
If Index = 0 Then
intMax = intMax + 1
Load tcpServer(intMax)
tcpServer(intMax).LocalPort = 0
tcpServer(intMax).Accept requestID
Call simcontrol.DeployUCAR
End If
End Sub

What am I doing wrong??


.find Error? In Word? Invalid Use Of Property?
When I go to run my sub.. with this:

wordDoc.Content.Find.Text "search for this"

I get the following error:

Invalid use of property

why would it be doing that? I'm trying to do a search for a phrase in the entire word document.

Complile Error Invalid Use Of Property .editmode
I am having problems on able to edit the records in my database form my vb app.. I need some advise asap, I have been able to view and add new records no problem, but I am stuck on how to get this works properly i cud use some help... i am needing to edit records in the database and im unsure how to get it to work properly as .edit dont show up..... PLEASE HELP

Set MyConn = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Documents and SettingsownerMy Documentsmydatabase.mdb;"

Set MyNo = New ADODB.Recordset
MyNo.CursorLocation = adUseClient "Query", MyConn, adOpenDynamic, adLockBatchOptimistic, adCmdText
'adOpenKeyset , adLockPessimistic‘I had these there before above don’t know which one works of them?


Frame1.Enabled = True
Frame2.Enabled = True
Frame4.Enabled = True
Frame3.Enabled = True

CmdAddNew.Enabled = False
CmdAddNew.Visible = False '???????
cmdUpdate.Visible = False
cmdClose.Visible = True
lvwCustomers.Enabled = False
cmdCancel.Enabled = True
CmdSave.Visible = True


MyNo.EditMode‘here I get complile error invalid use of property
If txtfields(3).Text = "" Then Else MyNo!Address2 = txtfields(3).Text
If txtfields(26).Text = "" Then Else MyNo!ShipName = txtfields(26).Text
If txtfields(31).Text = "" Then Else MyNo!ShipAddress1 = txtfields(31).Text
If txtfields(32).Text = "" Then Else MyNo!ShipAddress2 = txtfields(32).Text
If txtfields(33).Text = "" Then Else MytNo!ShipCity = txtfields(33).Text
If txtfields(35).Text = "" Then Else MyNo!ShipZip = txtfields(35).Text
' If txtfields(8).Text = "" Then Else MyNo!Contact1 = txtfields(8).Text

ClearFields‘clears the fields
CustomersView‘this refreshes the view on the listview of the names

'End If

CmdAddNew.Enabled = True
CmdAddNew.Visible = True '???????
cmdUpdate.Visible = True
cmdUpdate.Enabled = False
cmdClose.Enabled = True
cmdClose.Visible = True
'Frame1.Enabled = False
'Frame2.Enabled = False
'Frame3.Enabled = False
'Frame4.Enabled = False
End Sub

i hope someone can help me

File1.path Error 380 Invalid Property Value
Can you help me ?

I'm basically reading into a filelistbox (file1) a folder of .pdf's from a network drive.

Private Sub Form_Load()

Dim fs As New FileSystemObject

'check for scans folder
Set fs = CreateObject("Scripting.FileSystemObject")
If (fs.FolderExists(location & "scansTRTO")) Then
fs.CreateFolder location & "scansTRTO"
End If

Dir1.Path = location & "scansTRTO"
File1.Path = Dir1.Path
File1.Pattern = "*.pdf"

The above lines in red give me an Error 380 Invalid property value.

I just can't fathom it out.
"location" is the mapped network drive path ie: "D:Training"

The error only shows when I run the program on the clients PC not on mine.

Any ideas Guys?

Receive Invalid Syntax Error When Using ValidationRule Property.

I'm working with VB6 and having trouble setting the ValidationRule property. When I use the code:
MyField.ValidationRule = "Help"
the access table (Access 97) opens successfully, showing the Validation Rule. But when I try to use:
MyField.ValidationRule = "<= 99.9" (the validation I need)
I get the following error when opening the access table: "The expression you entered contains invalid syntax." and
the Validation Rule is empty. I've tried different combinations (w/o =, <, ., ") and the error message is the same.
Any ideas?? I would appreciate any help!! Thank U.

'Invalid Property' Error 380 When I Try To Resize A Child Form
Attached is my code (still learning how to progam VB as a stand alone program, rather than doing it in Access).

My problem is as follows:

I have a MDI Parent form. Inside of that I have several forms (depending on what the user wants to use) displayed as a child form. I have code in the child form (at this point, I only have one form done) to display scrollbars on the child form based on how much of the form is actually displayed ( just like how the parent form displays scollbars depending on whether or not the entire shild form is visible or not).

If you grab the lower right corner of the child form, it will stop at the values set (in this case, 4000 and 5000) However, I would also like the have he parent form stop at the same values ( I think I know where to do this, but since this is new territory for me, I thought that i would seek some expert advice on this. )

Another issue that I have is that with the parent form maximized, and the child form loaded and displayed, there are no error's. However, if you click the minimize button of the child form, I get an error that says that properties can't be changed while the form is minimized or maximized. This makes no sense to me because the child form is not maxed at that time. If, however, I max the child for, the try to minimize it, i also get this same error. I understand that the Top, Height, Width (and I can't remember the 4th one) can't be changed during a resize, but I am clueless on how to check the window state. I have read several topics on this site and even tried a few suggestions to similar problems, but nothing has worked. If anyone can help with this, I would greatly appreciate it.

Again, attached is the project code. You will have to create an access database, or even a text file file, with the name FDN_DWG_INDEX.MDB There doesn't have to be anything in it tho (its just checking for a file name). ONce the app is running, the form is located in FORMS>INPUT DRAWING

Thanks again for the help.

Invalid Use Of Property ERROR?? Function Calls?? What I Do Wrong??
I am using the Pictureclip control, which I have found pretty cool for what I¡¦m doing. I have a large number of screen shot images that I load one at a time. With each large image I copy about 22 very small images from the large image. I do this to determine the state of another application that is running on the desktop. All of the locations and sizes to copy from are predefined in a lookup table or array of my choosing. I am trying to write a function that returns a small bit map image or picture of the clip. I have had no problems getting the picture clip control to work. The inputs to my function are X, Y, width and height.

2 Part Question:
First I would like to make an array of packets containing these four values(X,Y,W,H) for each element in the array. We shall call this the array of ClipLocations. I would like to pass this information to the function in the form of

For i = 1 To 22
    ¡¥get the clip from a given location
    Picture1.Picture = GetMyClip(ClipLocation(i))

   ¡¥ do other things here like store image in array or do comparison to other images


How do I define or use a type that holds all four values (X,y,Width,Height) so I can make an array of all of the clip loctions in one simple array. Would this be an array of arrays.

Part Two
Second my current code is as follows, I¡¦m getting an Invalid use of property error that I do not under stand. The help file anwser is as follows:

You are using one kind of Property procedure where a different kind is expected. This error has the following causes and solutions:
„h You are trying to write to a property that is read-only. Ect. From the help file

'This is my current code

Private Sub Form_Load()
    Picture1.Picture = GetMyClip(220, 143, 18, 26)
End Sub

     'This is the function
Private Function GetMyClip(ULX As Integer, ULY As Integer, LRX As Integer, LRY As Integer) As Picture

PictureClip1.ClipX = ULX
PictureClip1.ClipY = ULY
PictureClip1.ClipWidth = LRX
PictureClip1.ClipHeight = LRY
GetMyClip = PictureClip1.Clip ¡¥ERROR here Invalid use of Property ?????

End Function

Religion is a manifestation of evolution.

                                By John Leefers

Invalid Property Value - Error Recieved When Refilling The Form
Hi All,

I have designed a form on VBA(EXCEL) and when ever iam trying to enter the data and after submitting the data when i try to refill the form i get an error message "invalid property value "

It has got nothing to do with the choosing the right dropdown or entering the right kind of value in the text box ...

If required i can send in the form .....

please advise resolution .need help uegently .

Compile Error: Invalid Use Of Property -&gt; For Load On A Winsock Control??? HELP!
Hello all,
I have a winsock object on a form, and when I try to do a connection to it I get this error:

Compile error: Invalid use of property

The "Load" word is highlighted in this code:

Private Sub tcpServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
intMax = intMax + 1
Load tcpServer(intMax)
tcpServer(intMax).LocalPort = 0
tcpServer(intMax).Accept requestID
End If
End Sub

I have the Index set to zero.. What am I doing wrong?? The code for the Handler was taken from MSDN's example of using the winsock control for multiple connections..


About Error 450: Wrong Number Of Arguments Or Invalid Property Assignment
What I did was simply to change date 'MMM-YY' based on user inputs. The code goes like this:

Sub ChngMonth()
MMMYY = InputBox("Enter The Last Data Month (mmm-yy):")
If MMMYY = "" Then Exit Sub
ddmmmyy = "15-" & MMMYY
For i = 0 To 330 Step 30
j = 12 - i / 30
Worksheets("Monthlist").Cells(1, j) = "'" & format(CDate(ddmmmyy) - i, "mmm-yy")
End Sub

When I run it, I will have 450 for 'format()' statement. But the funny thing is I don't always get that error. For some workbooks, I do; the others, I don't. I guess it has something to do with the way the book was set up; or some options that I didn't select. If the problem is with "Wrong number of arguments", how come for some workbooks it works, some not, using the same statement.
Thanks in advance.

Compile Error: Invalid Use Of Property -&gt; For Load On A Winsock Control??? HELP!
Hello all,
I have a winsock object on a form, and when I try to do a connection to it I get this error:

Compile error: Invalid use of property

The "Load" word is highlighted in this code:

Private Sub tcpServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
intMax = intMax + 1
Load tcpServer(intMax)
tcpServer(intMax).LocalPort = 0
tcpServer(intMax).Accept requestID
End If
End Sub

I have the Index set to zero.. What am I doing wrong?? This code for the handler can be found in MSDN Multiple Winsock connections help page... so I must be doing something else wrong that affects that Load statement!


Compile Error: Invalid Use Of Property -&gt; For Load On A Winsock Control??? HELP!
Hello all,
I have a winsock object on a form, and when I try to do a connection to it I get this error:

Compile error: Invalid use of property

The "Load" word is highlighted in this code:

Private Sub tcpServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
intMax = intMax + 1
Load tcpServer(intMax)
tcpServer(intMax).LocalPort = 0
tcpServer(intMax).Accept requestID
End If
End Sub

I have the Index set to zero.. What am I doing wrong??


Rounding Error: Wrong Number Of Arguments Or Invalid Property Assignment
I am experimenting with a program that calculates compound interest. As you can see the balance is produced in a box for each year for 9 years. Now I want to have a button by each of those boxes so I can round the balance. Now when I click on the button to round I get an error saying "Wrong number of arguments or invalid property assignment." I have tried everthing I can think of to fix this but can't. Hoping one of you can check out some of my source and figure out whats wrong. Here are parts of the source that I think might be helpful:

f = Val(Interest.Text): P = Val(Principal.Text): z = 100: Dim B As Single
I = f / z
A = I * P
B = A + P
Year1.Text = CStr(B)
Private Sub Round_Click()
B = Round(B, 2)
End Sub

Compiler Error: Wrong Number Of Arguments Or Invalid Property Assignment
I am trying to call a C++ function from VB but I am getting an error when I
compile on VB6, the error is: Wrong number of arguments or invalid property
assignment, I am sure it has somethin to do with invalid property assignment,
if someone came across the same error, can you please help me.
Thank you very much in advance.
C++ fucntion in Dll is:
typedef DWORD far *LPDWORD;
typedef unsigned long DWORD;
EPP_API DWORD EppGetDGReadingTime( WORD dgIndex, LPDWORD time ){
*time = AnIntValue; //an int value is assigned to time reference
return STAT_SUCCESS; //STAT_SUCCESS type is long
and in VB I have: (note that the time is accually an int value)
Public Declare Function EppGetDGReadingTime Lib "CbnEppDll.dll" (ByVal
dgIndx As Integer, ByRef time As Integer) As Long
it is called in VB code as follows:

Dim dgIndx As Integer
Dim time As Integer
EppGetDGReadingTime(dgIndx, time)

Error 3271 - Invalid Property Value Occurs During Execution Of My Querydef [Resolved!]
hi all, i have a problem inserting a lengthy text into my ms access 2000 table memo field using querydef and parameters...

my query: "aquery"
PARAMETERS [a] Long, [bee] Text ( 1000 );
VALUES ([a], [bee]);

table structure:
a is a Long
bee is a memo

and in my VB, my code is:
    Set qIns = db1.QueryDefs("aquery")
    qIns.Parameters(0) = 1
    qIns.Parameters(1) = txtProject_Description ' This is a 300-character long textbox
    qIns.Execute dbFailOnError

when I execute, this error pops...
run-time error '3271'
invalid property value

May I know how do we use this method to save the lengthy data into the table? Or is there any alternatives?

Thanks ;)

Edited by - amao on 5/26/2005 7:01:25 PM

How To Toss An Error Message For An Invalid ActiveX Control Property Assignment?
Hi, there
I am working on an VB activeX control. In the "Let" functions of my control's properties, I'd like to report those invalid assignment. For example, if the user assigned a negative value to a property which only accepts positive value, I would like VB to pop up a message box with a red cross in it and carries the error message defined by me. I know how to achieve it with ATL control, but I don't know how with VB activeX control. Please advise and thanks in advance...

Copyright © 2005-08, All rights reserved