La Web del Programador: Comunidad de Programadores
 
    Pregunta:  8173 - IMPRIMIR UN REGISTRO DE LA DB CON CRYSTAL REPORT
Autor:  lore Sánchez Chamoso
Hola me gustaría que me ayudarais a resolver un problema que tengo.
Estoy creando un sistema en Visual Basic y en él utilizo informes creados con Crystal Reports.
El problema viene al hacer que visualice una factura de la BD's que yo consulto en el momento de ejecución.
Resumiendo: no sé con qué instrucción le indico a Crystal Report la factura que quiero que presente el informe.
Me gustaría que me contestarais lo más pronto posible, lo necesito.Gracias.

  Respuesta:  Sergio Durán
Hola, bueno se cuando pudiste efectuar la pregunta pero, de seguro mi respuesta le servirá a más de alguien. Para imprimir Facturas de Compra y Venta, Guías de Despacho, etc., desde VB6, utiliza el Objeto Printer y así te olvidas para siempre de Crystal Report y sus licencias y además de DataReport (propio de VB).
Yo programo con VB6 y uso el obeto printer en combinación con Impresoras matriciales Panasonic KX-P1150 y Epson LX-300 + II, sin ningún problema.

Hago algo así:

Nimp = rs26.Fields(0).Value


'Establece Impresora
For Each Prnt In Printers
If Prnt.DeviceName = Nimp Then
Set Printer = Prnt
Exit For
End If
DoEvents
Next Prnt

With Printer
'Dimensiones papel a usar
.Width = Int(rs26.Fields(3).Value * 56.7)
.Height = Int(rs26.Fields(4).Value * 56.7)

'un de dibujo del papel a usar
.ScaleMode = 0
.ScaleWidth = rs26.Fields(3).Value * 10
.ScaleHeight = rs26.Fields(4).Value * 10

'Orientación papel a usar
.Orientation = rs26.Fields(5).Value
'.Port = Trim(CStr(rs26.Fields(1).Value))

'Printer.PaperBin = 15 'Bandeja
.PrintQuality = vbPRPQMedium
.Zoom = 100

.Font.Name = "Calibri"
.FontSize = rs26.Fields(6).Value
.FontBold = False
.FontItalic = False
.FontStrikethru = False
.FontUnderline = False
.ForeColor = vbBlack

'CABECERA GUÍA
.CurrentX = rs26.Fields(7).Value / 0.1: .CurrentY = rs26.Fields(8).Value / 0.1
Printer.Print Format(Me.Gui1.Value, "dd")

.CurrentX = rs26.Fields(9).Value / 0.1: .CurrentY = rs26.Fields(10).Value / 0.1
Printer.Print Format(Me.Gui1.Value, "mmmm")

.CurrentX = rs26.Fields(11).Value / 0.1: .CurrentY = rs26.Fields(12).Value / 0.1
Printer.Print Format(Me.Gui1.Value, "yyyy")

End With

'GLOSA GUÍA
rgl = CLng(rs26.Fields(39).Value / 0.1)

With Me.MSFlexGrid4
For prt = 1 To .Rows - 1
.Row = prt

.Col = 1
Printer.CurrentX = rs26.Fields(41).Value / 0.1: Printer.CurrentY = rgl
Printer.Print .Text;

rgl = rgl + CLng(rs26.Fields(45).Value / 0.1)
If prt = CLng(rs26.Fields(44).Value) Then Exit For
DoEvents
Next prt
End With

'PIE GUÍA
With Printer
.CurrentX = (rs26.Fields(35).Value / 0.1) - .TextWidth(Gui22.Text) 'TOTAL
.CurrentY = (rs26.Fields(36).Value / 0.1)
If Gui22.Text = 0 Then
Printer.Print ""
ElseIf Gui22.Text > 0 Then
Printer.Print Gui22.Text
End If

'.NewPage
'Printer.Print ""
.EndDoc
.KillDoc
.TrackDefault = True
End With

'Cierra y descarga de memoria el recordset
If rs26.State = 1 Then rs26.Close
Set rs26 = Nothing


http://bio-soft.cl/
CONCEPCIÓN CHILE

  Respuesta:  Juan Alvarez
Crea un reporte (Factura.rpt) en el cual se imprima todos los numeros de factura con su respectivos movimientos, al momento del diseño si le das una vista preliminar te daras cuenta que se veran todas tus facturas con sus respectivos movimientos, pero finalmente en el momento de la impresion osea cuando esta corriendo tu programa solo seleccionas uno y lo harias de la siguiente manera:

CR.ReportFileName = "Factura.rpt"
CR.SelectionFormula = "{Tabla.NoFactura}='" + Text1.Text + "'"
CR.Action = 1
Suponiendo que en text1.text esta el numero de la factura que quieres imprimir y que tengas una tabla con un campo llamado NoFactura, espero haberme explicado

Mas dudas me Escribes ok

  Respuesta:  joaquin
BUSCA LA AYUDA DE CRYSTAL REPORT Y LEETE LA INSTUCCION "SELECTION FORMULA", AUNQUE HAY OTRAS MANERAS ESTA ES LA MAS SENCILLA