hi guyzz... i have more than 1000 datas in my tables i loaded it in the listview using function..
but i have problem in loading it.. it consume almost 9 second to load all in the listview...
i think it is in my coding.. i would like to minimize it. here my code.
Private Sub userPriceList1()
Set rsFltUser = Nothing
Set rsFltUser = OpenRS("Select branchcode,branchname,item_Number,item_name,balance_unitcost,balance_unit from itemlist order by item_name")
With rsFltUser
If .RecordCount <> 0 Then
.MoveFirst
Do While Not .EOF
Set lstitems = frmPOS.ListView2.ListItems.Add(1, , !branchcode & " - " & !branchname)
lstitems.SubItems(1) = IIf(IsNull(!item_Number), "", (!item_Number))
lstitems.SubItems(2) = IIf(IsNull(!item_name), 0, !item_name)
lstitems.SubItems(3) = FipoMethod(lstitems.SubItems(1), IIf(IsNull(!balance_unitcost), 0, !balance_unitcost))
.MoveNext
Loop
End If
End With
End Sub
Private Function FipoMethod(itmNO As String, Optional SCost As Currency) As Currency
Dim rs2 As ADODB.Recordset
Set rs2 = Nothing
Set rs2 = OpenRS("select item_number,srp_value,srp_setup from itemlist where item_number = '" & itmNO & "'")
With rs2
If .RecordCount <> 0 Then
If IsNull(!srp_value) = True Then !srp_value = 0
Select Case !srp_setup
Case 0
FipoMethod = Format(IIf(IsNull(!srp_value), 0, !srp_value), "standard")
Case 1
FipoMethod = Format(SCost + (CCur(SCost) * ("." & Val(!srp_value))), "standard")
Case 2
FipoMethod = Format(CCur(SCost) + CCur(!srp_value), "standard")
End Select
End If
End With
Set rs2 = Nothing
End Function
i tried already the byref and byval...
any suggestion wil be appreciated.
thx in advance