|
-
Feb 27th, 2008, 03:55 AM
#1
Thread Starter
Frenzied Member
[RESOLVED]Problem in write values in Report
Hi to all:
I have this little lines of code to write in the report,but the report don't show the text,given in the instruction:
Code:
Private Sub Form_Load()
Dim Rptapp As New CRAXDRT.Application
Dim Rpt As CRAXDRT.Report
Dim formula As CRAXDRT.FormulaFieldDefinition
Set Rptapp = New CRAXDRT.Application
Set Rpt = Rptapp.OpenReport("F:\Projectos VB\NORWIN\decl.ivapoc.rpt")
'The text "Declaracao" is that I want to put in the formula
For Each formula In Rpt.FormulaFields
If formula.Name = "{@C_002}" Then
formula.Text = "'Declaracao'"
End If
Next
setviewersize
CRViewer1.ReportSource = Rptapp.OpenReport("F:\Projectos VB\NORWIN\decl.ivapoc.rpt")
CRViewer1.ViewReport
end sub
=========================================================
Private Sub Form_Resize()
setviewersize
End Sub
=========================================================
Private Sub setviewersize()
CRViewer1.Width = FrmDeclaracaoIVA.Width - 500
CRViewer1.Height = FrmDeclaracaoIVA.Height - 400
End Sub
==========================================================
Any error in the code or something missing?
Thanks
Last edited by sacramento; Feb 28th, 2008 at 01:46 AM.
-
Feb 27th, 2008, 10:45 AM
#2
Re: Problem in write values in Report
Instead of opening the report again, use this
CRViewer1.ReportSource = rpt
-
Feb 27th, 2008, 11:02 AM
#3
Thread Starter
Frenzied Member
Re: Problem in write values in Report
Hi brucevde:
That's it...work wonderfull..
Just one more thing please:
This is for text:
formula.Text = "'Declaracao'"
but for numbers I had try:
formula.value = "'125,00"'
but VB return a error mesage in formula.value...
Any other syntax for numbers?
Thanks
-
Feb 27th, 2008, 12:48 PM
#4
Re: Problem in write values in Report
Always use Formula.Text. It contains the formula you are trying to create. Formula.Value is a read-only property that returns the result of the formula.
If all you want the formula to do is return a number, the vb code would be
Code:
formula.Text = "125,00"
-
Feb 28th, 2008, 01:45 AM
#5
Thread Starter
Frenzied Member
Re: Problem in write values in Report
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
|