Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/04/2007, 15:24
yumova
 
Fecha de Ingreso: abril-2007
Mensajes: 2
Antigüedad: 17 años
Puntos: 0
problema con variable para consulta VBA lib. ADO 2.5

Hola a todos, soy nuevo en esto, y espero me puedan ayudar con este codigo ya que la variable no me funciona correctamente con el select en VBA.. arroja un error 13 "NO COINCIDEN LOS TIPOS" gracias:

Sub tiempos()


el_id = InputBox("digite el id")
Dim cnFacturacion As ADODB.Connection
Dim rsFacturacion As ADODB.Recordset

Set cnFacturacion = New ADODB.Connection
Set rsFacturacion = New ADODB.Recordset

cnFacturacion.Open "ado", "root", ""
rsFacturacion.Open "select id_factura, sum(id_cliente) from facturacion where id_factura = \" & el_id \ " group by id_factura", cnFacturacion, adOpenDynamic, adLockOptimistic

ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=3, NumColumns:= _
4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
If .Style <> "Tabla con cuadrícula" Then
.Style = "Tabla con cuadrícula"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With

Do While Not rsFacturacion.EOF
Selection.TypeText Text:=rsFacturacion(0)
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:=rsFacturacion(1)
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:=rsFacturacion(0)
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:=rsFacturacion(1)
Selection.MoveRight Unit:=wdCell
rsFacturacion.MoveNext
Loop



End Sub