RE:Abrir .rpt Externo en VB6.0
por ejemplo al terminar una factura:
Data1.RecordSource = "SELECT idfactura FROM facturas WHERE idusuario = " & principal.usuario.Caption & " ORDER BY idfactura DESC"
Data1.Refresh
'If msgyn("Desea Imprimir la factura?") = True Then Call reportes("rfacturas.rpt", "Reporte de Facturas", "{q.idfactura} = " & Data1.Recordset!idfactura, True, , False)
Call reportes("rfacturas.rpt", "Reporte de Facturas", "{q.idfactura} = " & Data1.Recordset!idfactura, True, , False)
la funcion reportes pegala en un module
Public Function reportes(rnombre As String, title As String, seleccion As String, Optional ByVal ip As Boolean = False, Optional ByVal zoom As Integer = 100, Optional ByVal page As Boolean = True)
'ip = False (Para el preview)
frmAbout.Report.DiscardSavedData = True
frmAbout.Report.ReportFileName = App.Path + "RPT" + rnombre
If page = True Then
frmAbout.Report.printername = pgde
frmAbout.Report.PrinterDriver = driverg
frmAbout.Report.PrinterPort = puertog
Else
frmAbout.Report.printername = ppeq
frmAbout.Report.PrinterDriver = driverp
frmAbout.Report.PrinterPort = puertop
End If
frmAbout.Report.Connect = "Dsn=" & base & ";UID=usersql;Pwd=i2osietnq;DBQ=" & base
frmAbout.Report.WindowTitle = title
frmAbout.Report.WindowState = crptMaximized
frmAbout.Report.SelectionFormula = seleccion
If ip = True Then
frmAbout.Report.Destination = crptToPrinter
Else
frmAbout.Report.Destination = crptToWindow
End If
frmAbout.Report.Action = 1
If ip = False Then
frmAbout.Report.PageZoom zoom
End If
End Function
eso es todo