Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selection formula error and set picture at run-time

Status
Not open for further replies.

elsacarlsson

Programmer
Jul 23, 2002
6
SE
When I try to insert a selection formula (group selection) from visual basic to my report, I get error msg 20515 : error in formula, the remaining part of the text doesn't seem to be a part of the formula, but when I paste it into the report, the formula works.

this is what the code looks like:

Public Sub ShowCrystalReport(CrystalCtrl as CrystalReport, StrReportName as String, StrHeading as String, Optional StrSelectionFormula as string)
Dim IntRunner as Integer, IntTemp as Integer
Dim StrDataFiles as String

StrDataFiles = App.Path & "\mydb.mdb"

With CrystalCtrl
.ReportFilename = App.Path & StrReportName
.DataFiles(0) = StrDataFiles
.IntTemp = .GetNSubreports

For IntRunner = 0 to IntTemp - 1
StrTemp = .GetNthSubreportName(IntRunner)
.SubreportToChange = StrTemp
.DataFiles(0) = StrDataFiles
Next

.SubreportToChange=""
.Destination = crptToWindow
.WindowTitle = StrHeading
.ParameterFields(1) = "RprtHeading;" & StrHeading & ";true"
.GroupSelectionFormula = StrSelectionFormula
.PrintReport
End With
End Sub

why doesn't it work?

furthermore, I want to have two pictures in the report header that the user of my application should be able to change at runtime (by setting the path). How do I solve this?
thanks in advance
 
The most common problem is that the formula being assembled and passed isn't going over in exactly the same way as the working formula. Can you capture the literal string that is being passed to compare it? What happens if you cut the working formula from CR and pass it through as a fixed literal from the app? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top