The first argument, "0", is a zero-based index representing the position in the group structure the new group should take. It is somewhat counter-intuitive in that group 1 doesn't correspond to GH1 in the Crystal report. Rather, 0 would be Group 1, 1 would be Group 2, etc.
Also, while the group tree in the viewer will show the group and it's values, the RDC doesn't automatically place anything in the group header or footer. And adding items in there may require using CRAXDDRT and paying royalty fees.
I wrote the code using CR 9, but tested it with the CR 8.5 RDC and it works the same. So, please post the error message you are getting, and the exact code you've written to implement the above sample. Obviously, the formula name "Year" needs to be replaced by your formula, and--one thing I didn't mention--the formula must already exist in the Crystal report (even if the formula text will later be changed).
From your code, it appears that you're using CPEAUT32.DLL. You don't show how you've declared the variables, nor do you show the error message you get on the line that fails, so it makes it hard to determine what your issue is. The code below works with the CR 8 CPEAUT32.DLL and should get you in the ballpark:
--------------------------------------------
Dim crwApplication As CRPEAuto.Application
Dim CRWReport As CRPEAuto.Report
Private Sub Form_Load()
Dim crwDB As CRPEAuto.Database
Dim crwTable As CRPEAuto.DatabaseTable
Set crwApplication = CreateObject("Crystal.CRPE.Application"
Set CRWReport = crwApplication.OpenReport("C:\Program Files\Microsoft Visual Studio\VB98\Archived Apps\Report Integration Cert\Customer Profile.rpt"
Set crwDB = CRWReport.Database
Dim crTable As CRPEAuto.DatabaseTable
Dim crField As CRPEAuto.DatabaseFieldDefinition
Set crTable = crwDB.Tables("Employee"
Set crField = crTable.Fields("Employee ID"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.