Results 1 to 5 of 5

Thread: [RESOLVED]Problem in write values in Report

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2004
    Posts
    1,414

    Resolved [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.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Problem in write values in Report

    Instead of opening the report again, use this

    CRViewer1.ReportSource = rpt

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2004
    Posts
    1,414

    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

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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"

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2004
    Posts
    1,414

    Re: Problem in write values in Report

    ok...Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width