Ver Mensaje Individual
  #8 (permalink)  
Antiguo 20/12/2011, 07:23
Avatar de lokoman
lokoman
 
Fecha de Ingreso: septiembre-2009
Mensajes: 502
Antigüedad: 14 años, 7 meses
Puntos: 47
Respuesta: No me muestra los datos que quiero

Bueno, chequea:

• Propiedades del DataCombo1:

BoundColumn=Nombre del Campo
DataField=Nombre del Campo
ListField=Nombre del Campo que presentará el DataCombo

• Codigo:

Código vb:
Ver original
  1. Private Sub Form_Load()
  2.     Cargar
  3.     Presentar_Datos
  4. End Sub
  5.  
  6. Private Sub Cargar()
  7.     On Error Resume Next
  8.    
  9.     Dim rstUNIDADES As ADODB.Recordset
  10.     Set rstUNIDADES = New ADODB.Recordset
  11.  
  12.     With rstUNIDADES
  13.         .ActiveConnection = CONEXION
  14.         .Open "select unidades(selctunidadmaest) as dtc1 from unidades"
  15.     End With
  16.  
  17.     Set DataCombo1.RowSource = rstUNIDADES
  18.  
  19.     IF rstUNIDADES.STATE=1 THEN rstUNIDADES.CLOSE
  20.     Set rstUNIDADES = Nothing
  21. End Sub
  22.  
  23. Private Sub Presentar_Datos()
  24.     coef.Text = "1 " & DataCombo1.BoundText  & " = " & relauni(1).Text & " " & Text1(0).Text
  25. End Sub

Lo mas sencillo es usar un Combo normal y cargarlo asi:

Código vb:
Ver original
  1. Dim rstUNIDADES As ADODB.Recordset
  2.     Set rstUNIDADES = New ADODB.Recordset
  3.  
  4.     With rstUNIDADES
  5.         .ActiveConnection = CONEXION
  6.         .Open "select unidades(selctunidadmaest) as dtc1 from unidades"
  7.     End With
  8.  
  9.    cboNormal.Clear
  10.  
  11.    If rstUNIDADES.EOF = False Then
  12.       Do While rstUNIDADES.EOF = False
  13.          cboNormal.AddItem rstUNIDADES!DTC1
  14.          rstUNIDADES.MoveNext
  15.          DoEvents
  16.       Loop
  17.    Else
  18.       cboNormal.AddItem "No hay datos"
  19.    End if