Link to home
Start Free TrialLog in
Avatar of pinheiroa
pinheiroaFlag for Portugal

asked on

Get the report with crystal 8

Hello,

I'm trying to print a report using Crystral 8. In VB I've this code:

Private Sub Command1_Click()
    Me.CR.SelectionFormula = "{FACTURA.num_factura}=frmfactura.textbox1.text"
    Me.CR.Action = 1
End Sub

Private Sub Form_Load()
    Me.CR.ReportFileName = "D:\dev\InFactu\proGym\Reports\Factura.rpt"
End Sub

The problem is that I get the report, but without any data. What wrong / missing.

Pls help me!  Thanks.

Avatar of Mikal613
Mikal613
Flag of United States of America image

Maybe your report is not attached to the right DB or theres no data to be shown
Avatar of EwaldL
EwaldL

currently the report is only showing records, where the field {FACTURA.num_factura} has the  value "frmfactura.textbox1.text". you need to place the frmfactura.textbox1.text outside the string literal.

so try chaning this lineMe.CR.SelectionFormula = "{FACTURA.num_factura}=frmfactura.textbox1.text"

to something simliar to this if the field value is a number
Me.CR.SelectionFormula = "{FACTURA.num_factura}= " & frmfactura.textbox1.text

or if it's a string
Me.CR.SelectionFormula = "{FACTURA.num_factura}= '" & frmfactura.textbox1.text & "'"
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial