Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/11/2008, 23:05
Avatar de coco_wey
coco_wey
 
Fecha de Ingreso: noviembre-2005
Mensajes: 21
Antigüedad: 18 años, 5 meses
Puntos: 0
Respuesta: Buscar Facturas Por Fechas

Gracias SalomonSab y gracias Avellaneda q 100pre me ayudas XD....

solo tube q modificar el texto como lo pusiste y ponerle al final la funcion
"LlenarTabla" q creo q fuiste tu kien me ayudo con eso tambien XD... aki esta el code completo....

Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset

rs.CursorLocation = adUseClient
cn.CursorLocation = adUseClient

cn.Open "DRIVER={Microsoft Access Driver (*.mdb)};dbq=" & App.path & "\db1.mdb"

rs.Open "SELECT * FROM TablaGuardarFactura WHERE C_Fecha " & _
"BETWEEN #" & Format(TxtFechaIni, "mm/dd/yyyy") & "# " & _
"AND #" & Format(TxtFechaFin, "mm/dd/yyyy") & "# " & _
"ORDER BY C_Fecha", cn, adOpenStatic, adLockOptimistic
LlenarTabla

Esta es la funcion LlenarTabla

Private Sub LlenarTabla()
On Error Resume Next
rs.CursorLocation = adUseClient
cn.CursorLocation = adUseClient

If rs.RecordCount <> 0 Then
With MSFlexGrid2
.Rows = 1
.ColWidth(1) = 1300 'Num_Factura
.ColWidth(2) = 1200 'Fecha
.ColWidth(3) = 600 'Cantidad
.ColWidth(4) = 2000 'Descripcion
.ColWidth(5) = 1200 'Precio
.ColWidth(6) = 1200 'Total_Gral
.ColWidth(7) = 1000 'Hora
.ColWidth(8) = 1700 'Tipo De Pago
.ColWidth(9) = 1700 'Doctor

Dim i As Integer
For i = 1 To rs.RecordCount
MSFlexGrid2.AddItem vbTab & rs("C_Num_Factura").Value & vbTab & rs("C_Fecha").Value & vbTab & rs("Cantidad").Value & vbTab & rs("Descripcion").Value & vbTab & rs("Precio").Value & vbTab & rs("C_Total_Gral").Value & vbTab & rs("C_Hora").Value & vbTab & rs("C_Tipo_Pago").Value & vbTab & rs("C_Doctor").Value
rs.MoveNext
Next i
End With
End If
Me.Caption = "Facturas Encontradas: " & CStr(rs.RecordCount)
End Sub

Gracias..... a los 2

Última edición por coco_wey; 21/11/2008 a las 23:15