Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/01/2005, 17:42
Avatar de GeoAvila
GeoAvila
Colaborador
 
Fecha de Ingreso: diciembre-2003
Ubicación: Antigua Guatemala
Mensajes: 4.032
Antigüedad: 21 años, 4 meses
Puntos: 53
bueno mira aqui tento abiertas dos tables pero asi podes abrir las que querras..

Código:
Dim Cxn As Connection
Function Buscar_Facs(Nit As String)
Dim AdoS As New Recordset
Set AdoS = New Recordset
AdoS.Open "SELECT `cxc`.`no_factura`, `cxc`.`nit_cliente`, `cxc`.`no_ingreso`, `cxc`.`fecha`, `cxc`.`total`, `cxc`.`descripcion`, `cxc`.`observaciones`, `cxc`.`cancelado` FROM `cxc` WHERE (`cxc`.`cancelado` = 0) AND (`cxc`.`nit_cliente` = '" & Nit & "') ORDER BY `cxc`.`fecha`", Cxn, adOpenStatic, adLockOptimistic
Set CboFactura.DataSource = AdoS
Set CboFactura.RowSource = AdoS
CboFactura.BoundColumn = "no_factura"
CboFactura.ListField = "no_factura"
If AdoS.RecordCount > 0 Then
CboFactura.Enabled = True
CmdIrFac.Enabled = True
Else
CboFactura.Enabled = False
CmdIrFac.Enabled = False
End If
End Function
Function Buscar_Datos_Fac(NoFacturaS As String, Nit As String)
Dim AdoF As New Recordset
Set AdoF = New Recordset
AdoF.Open "SELECT `cxc`.`no_factura`, `cxc`.`nit_cliente`, `cxc`.`no_ingreso`, `cxc`.`fecha`, `cxc`.`total`, `cxc`.`descripcion`, `cxc`.`observaciones`, `cxc`.`cancelado`, `cxc`.`fecha_vencimiento`, `cxc`.`total_operado` FROM `cxc` WHERE (`cxc`.`cancelado` = 0) AND (`cxc`.`nit_cliente` = '" & Nit & "') AND (`cxc`.`no_factura` = '" & NoFacturaS & "')", Cxn, adOpenStatic, adLockOptimistic
Clean
If AdoF.BOF = False Then
Me.LblFechaFac.Caption = AdoF("fecha")
Me.LblFechaFacV.Caption = AdoF("fecha_vencimiento")
Me.LblValorFac.Caption = Format$(AdoF("total"), "########0.00")
End If
End Function
Private Sub Form_Load()
Set Cxn = New Connection
Cxn.CursorLocation = adUseClient
Cxn.Open CxnFac ' aqui tu conexion a la base de datos..
End Sub
espero te sirva el ejemplo.

nos vemos..
__________________
* Antes de preguntar lee las FAQ, y por favor no hagas preguntas en las FAQ
Sitio http://www.geoavila.com twitter: @GeoAvila

Última edición por GeoAvila; 21/01/2005 a las 17:43