Ver Mensaje Individual
  #2 (permalink)  
Antiguo 08/04/2005, 16:12
Avatar de vbx3m
vbx3m
 
Fecha de Ingreso: febrero-2005
Ubicación: Venezuela
Mensajes: 524
Antigüedad: 20 años, 3 meses
Puntos: 1
Bueno yo lo he llenado con adodb, si lo quieres hacer asi seria:

Option Explicit
Dim myConn As ADODB.Connection
Dim myRecSet As ADODB.Recordset

Private Sub Form_Load()
Set myConn = New ADODB.Connection
Set myRecSet = New ADODB.Recordset
myConn.CursorLocation = adUseClient
myConn.Open "PROVIDER=Microsoft.jet.OLEDB.4.0;data source=ruta.mdb;"
Call Fill_listbox("tabla", "campo", , List1, "campo") 'ordenado por campo o si quieres usas este otro

' Call Fill_listbox("tabla", "campo", , List1) 'no ordenado
End Sub

Public Sub Fill_listbox(ByVal sbTableName As String, ByVal sbFieldName As String, _
Optional ByRef comboName As ComboBox, Optional ByRef listName As ListBox, _
Optional ByVal sbOrder As String)
On Error Resume Next
If sbOrder = "" Then sbOrder = sbFieldName
listName.Clear
DoEvents
myRecSet.CursorLocation = adUseClient
myRecSet.Open "SELECT " & sbFieldName & " FROM " & sbTableName & " order by " & sbFieldName & ";", myConn, adOpenKeyset, adLockReadOnly
With myRecSet
Do Until .EOF
listName.AddItem .Fields(sbFieldName)
.MoveNext
Loop
End With
myRecSet.Close
Set listName = Nothing
End Sub

Espero te sirva...
__________________
ホルヘ・ラファエル・マルティネス・レオン