troubleshooting Question

Transferring Strings from VB to Crystal Reports

Avatar of BirdsOfFire1
BirdsOfFire1 asked on
Visual Basic Classic
3 Comments1 Solution422 ViewsLast Modified:
I am using VB6.0 with Crystal Reports 8.5 on WIN2000.
What I am trying to do is during runtime import string statement into the report using a recordset or without loading records in the report viewer.

On the report viewer, I have the following code:

This is posted in the declaration section of the form.
Dim Report As New CRAXDRT.Report


I have the following code in the Form_Load event of the report viewer form.

Dim StatusMsg1, StatusMsg2, StatusMsg3, StatusMsg4, StatusMsg5, StatusMsg6

Select Case selection     'Form name selected in the forms
                          'which is stored in the
                          'variable "selection".

   Case "ManufacturerReport"
      set Report = new rpt_ManufacturerReport
      me.caption = " Manufacturer's Report


   Case "StatusReport"
       Set Report = new rpt_StatusReport
       Me.caption = "Status Report"
       StatusMsg1 = "Process is complete"
       StatusMsg2 = "There were 500 Manufacturer's."
       StatusMsg3 = "There were 600 Price Check's."
       StatusMsg4 = "There were 200 Return's."
       StatusMsg5 = "There are 800 customer's."
       StatusMsg6 = "There are 100 prospects."
Report.FormulaFields(1).Text = "'" & StatusMsg1 & "'"
Report.FormulaFields(2).Text = "'" & StatusMsg2 & "'"
Report.FormulaFields(3).Text = "'" & StatusMsg3 & "'"
Report.FormulaFields(4).Text = "'" & StatusMsg4 & "'"
Report.FormulaFields(5).Text = "'" & StatusMsg5 & "'"
Report.FormulaFields(6).Text = "'" & StatusMsg6 & "'"

end select


rst.open SQLStatement, strConn, adOpenKeyset, adLockBatchOptimistic
Report.Database.setDataSource rst

I also set some properties for displaying the report viewer.

Report.PaperOrientation = 2
CRviewer1.ExableExportButton = true
.
.
.etc.
Then load and display the CRviewer.
CRviewer1.ReportSource = report ,etc.
CRviewer1.ViewReport

I would like to send the text fields to Crystal Report.  This code works when I use only the first three text fields.  I if use all six fields, I get a blank report with the error "This does not seem be a formula.  Cannot process the remaining items."

On the report viewer, I name each formula with the variable names (StatusMsg1, StatusMsg2, etc.) above.  So the report has six formulas with the same name.  The index value after the field property is the sequence of the formula in the Crystal Report.  I also have to put a "placeholder" string value for each formula field in the reportEditor screen.

How can I make this work so that all six string statements are transferred directly into and displayed in the Cystral Report not using a recordset to popoulate the CRviewer and then, using a recordset to populate the CRViewer?

Is there a better way?



Thanks, for your help.
The Firebird








ASKER CERTIFIED SOLUTION
Computer101

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros