-
run time error 380
I use the below code but a error massage show: "Invalid property value"
Code:
Dim RsL As New ADODB.Recordset
Dim sqlEmp As ListItem
LvwAddEmployees.ListItems.Clear
If RsL.State = 1 Then RsL.Close
RsL.CursorLocation = adUseClient
RsL.Open "Select * from Accounts", GConn, 3, 4
If (RsL.RecordCount > 0) Then
RsL.MoveFirst
End If
While Not RsL.EOF
Set sqlEmp = LvwAddEmployees.ListItems.Add(, , RsL!SrNo)
sqlEmp.SubItems(2) = RsL!AccountName
sqlEmp.SubItems(3) = RsL!OpeningBalance
RsL.MoveNext
Wend
Set RsL = Nothing
-
Re: run time error 380
In your Listview you have 1 Listitem and 2 Subitems? If so, those Subitems indexes are 1 and 2, not 2 and 3 (subitem 3 doen't exist that's the reason of this error), so it should be:
Code:
While Not RsL.EOF
Set sqlEmp = LvwAddEmployees.ListItems.Add(, , RsL!SrNo)
sqlEmp.SubItems(1) = RsL!AccountName
sqlEmp.SubItems(2) = RsL!OpeningBalance
RsL.MoveNext
Wend
-
Re: run time error 380
sorry it not work. and the same massage show again.
-
Re: run time error 380
Did you Insert 3 columns in the Listview? (right click, properties, Column Headers, Insert 3 Columns)
-
Re: run time error 380
I haven't had my early morning coffee yet :(
Could you exactly point out which line is giving you the error?
-
1 Attachment(s)
Re: run time error 380
now it work (insert 3 column) but 1st row not show and the 2nd row r same. and it show extra 2 column before Account Name. how can I solve it.
-
Re: run time error 380
Maybe you added 4 columns insted of 3, delete the firt one.
-
Re: run time error 380
no. I insert 3. another thing about row. why 1st row hide and 2nd row ?
-
Re: run time error 380
upload your form for a faster resolution.