Results 1 to 5 of 5

Thread: [RESOLVED] CR4 runtime parameters

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2004
    Location
    Northern Territory, Australia
    Posts
    61

    Resolved [RESOLVED] CR4 runtime parameters

    Hi all,

    Apologies to readers of the Xtreme forum; I wasn't getting any bites there.

    I'm putting together a front-end for an Access 97 db using VB6 and CR4.

    Yes, I know CR4 is ancient history, but I'm a part-time as-needs-be programmer, and I can't justify the expense of a developer edition of a later CR.

    I want to produce reports on the data, using an identical report (layout-wise) but with different sets of data. So I should only need to distribute one report file, which I can manipulate at runtime to show the different result sets. I can adjust the data itself, using the .SelectionFormula and .SortFields runtime properties in the VB code.

    What I want to do, and I'm having trouble with, is putting a heading on each report, which will differ for each of four different data sets.

    I can't find a way of passing a text field to CR4 from VB6. I tried inserting a db field in the report, then creating a table in the db to hold just one record: the required heading, which I could set at runtime. But that didn't work, the records did not display at all, whether the heading was in the 'Title' or 'Page Header' section.

    Of all the methods and properties that the CR4 object lets you pass to VB6, the only one that looks useful is 'BoundReportHeading' - but that just sets the title of the report, and I can't see any way to print that with the report.

    any ideas gratefully accepted, Peter
    Last edited by Hack; Mar 24th, 2006 at 09:07 AM. Reason: Added [RESOLVED] to thread title and green "resolved" checkmark

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: CR4 runtime parameters

    How about
    VB Code:
    1. CrystalReport1.ReportTitle = "Whatever"
    Is this what you mean?

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2004
    Location
    Northern Territory, Australia
    Posts
    61

    Re: CR4 runtime parameters

    hack, the cr4 help file for that property says:

    "The value of the ReportTitle is not displayed in any part of the report, but is provided for your own use."

    you have to wonder why they bother then, really.

    I think I'll need a trickier workaround, but it's got me beat for now.

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2004
    Location
    Northern Territory, Australia
    Posts
    61

    Re: CR4 runtime parameters

    ok, uncle peter's got it sorted. using the 'formulas' property, it goes something like this:

    Code:
        Dim ReportHeading As String
    
    ....
            
        If optReport(3).Value = True Then
            ReportHeading = "Men's chronic disease reviews for " & Format(Now, "mmmm")
        Else
            ReportHeading = "Men's chronic disease reviews for " & Format(DateAdd("m", 1, Now), "mmmm")
        End If
    
    ....
            
        crpReports.ReportFileName = "cddb.rpt"
        
        crpReports.Formulas(0) = "heading = " & Chr(34) & ReportHeading & Chr(34)
        crpReports.PrintReport
    There is a Formula field in the report called 'heading', which this code feeds.
    Voila! Knew there had to be a way.

    thanks, Peter

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [RESOLVED] CR4 runtime parameters

    Thanks for posting what you found.

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