|
-
Apr 25th, 2009, 12:36 AM
#1
Thread Starter
Junior Member
problem on passing value
i have a text box and i want the value on my textbox is place on the my crystal, im new to crystal report.....
Code:
Private Sub cmdprint_Click()
Dim oApp As CRAXDRT.Application
Dim oReport As CRAXDRT.Report
Set oApp = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\Reports\other_deduction.rpt", 1)
oReport.Database.SetDataSource dataother.DataSource, 3, 1
oReport.ParameterFields.GetItemByName(oReport.Sections(1).ReportObjects(2).Name).AddCurrentValue "'" & Text1.Text & "'"
frmprintview.CRViewer91.ReportSource = oReport
frmprintview.CRViewer91.ViewReport
frmprintview.Show 1, frmother
End Sub
but it will prompt an error of invalid name...
my crystal report version is 9.2
Online on 8pm to 3am.......philippines time...
making a maze on my head.....
Last edited by knight_jose; Apr 25th, 2009 at 12:41 AM.
-
Apr 25th, 2009, 02:41 AM
#2
Re: problem on passing value
I think it's better using a formula field
Add a formula field to your rpt
Let's say that your formula field name is @MyFormula and the text is :
Now from your app, it sould be something like
Code:
Dim GInt2 As Integer
For GInt2 = 1 To oReport.FormulaFields.Count
Select Case oReport.FormulaFields(GInt2).Name
Case "{@MyFormula}": CRReport.FormulaFields(GInt2).Text = "Trim(" & Chr(39) & Trim(Text1.Text) & Chr(39) & ")"
.
.
End Select
Next GInt2
-
Apr 25th, 2009, 12:02 PM
#3
Thread Starter
Junior Member
Re: problem on passing value
i want the value on my textbox get into the crystal report.......
i may not use any of the formula, all i need is to place the value on my textbox on vb6 to then text on my crystal report textbox on the header so that is have a detail information..
the value im going to place on my textbox on crystal report is not in the database?.......................................................
by the way thank reply...
-
Apr 25th, 2009, 06:07 PM
#4
Re: problem on passing value
Create a new formula field in CR
Place that formula field in the Header Section instead of the text box
Pass the Text1.Text value from VB app to CR formula field
Try the way I posted in #2
That's how I pass almost all the variable data to CR reports and work ok
Remember that not all CR formula fields return numeric data, that why I use the next as the body of the formula
Code:
Trim("Some Text at design time")
and at execution time we can replace that text by other data, in this case the text1. content
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|