'How to load the values of a recordset in a combo box object
Public Sub FillData_ListBox(ByRef lstControl As Object, ByRef strQry As String)
'this routine is used to fill up a list box by passing 'the lstbox name and
'query
Dim lstCtrlObj As Object
Dim Rst As ADODB.Recordset
On Error GoTo VBError
Set Rst = New ADODB.Recordset
With Rst
.Source = strQry
.Open , AdoComp, adOpenDynamic, adLockReadOnly
End With
Set lstCtrlObj = lstControl
lstCtrlObj.Clear
If Rst.EOF = False Then
Rst.MoveFirst
While Rst.EOF = False
lstCtrlObj.AddItem Rst.Fields(1)
lstCtrlObj.ItemData(lstCtrlObj.NewIndex) = Rst.Fields(0)
Rst.MoveNext
Wend
itsRecCount = 1
itsProcessClickFlag = True
lstCtrlObj.ListIndex = 0
End If
Done:
Rst.Close
Set Rst = Nothing
Exit Sub
VBError: ' Non-ADO error handler
DisplayVBError
GoTo Done
End Sub
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :