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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Addgroup alternative ?

Status
Not open for further replies.

Frank336

MIS
Aug 6, 2002
41
CA

Hi, Im using Vb6 with RDC and an access 2000 database.

I would like to dynamically add groups to a report from VB(3 level of grouping possible).

the result could be :

Level1
Level2
Level3

ID Name
ID Name
...


I was using Addgroup which is royalty-free but for
adding a field in a group i need AddFieldObject (not royalty-free).

So is there another way to do that ? Can I group on a parameter pass from VB ?

Thanks,
Frank
 
You can create a formula that returns different fields based on a parameter. Then group on that formula.
For example,
------------------------------------------
IF {?group_by} = "Product Type" THEN {Product_Type.Product Type Name} ELSE {Customer.Customer Name}
------------------------------------------

Cheers,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 

... Everything was working until i decide to move my report into a subreport.

To pass my parameters to the subreport I use a shared variable and i change the formula from :

WhileReadingRecords;
IF {?group_by} = "Product Type" THEN {Product_Type.Product Type Name} ELSE {Customer.Customer Name}


to :

WhileReadingRecords;
IF {@Shared_Group} = "Product Type" THEN {Product_Type.Product Type Name} ELSE {Customer.Customer Name}


Now have got the error :

This formula cannot be used bacause it must be evaluate later.


What am I doing wrong ?

And is there a way to pass a parameter directly to subreport ? I think I saw a way to declare a subreport as a report (but Im not sure about that).


Thanks,
Frank
 
Change
WhileReadingRecords;
to
WhilePrintingRecords;

Cheers,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Also, consider changing from a shared variable approach to passing the choice to the subreport as a linked parameter.

hth,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top