Hey Manish,
Thanks for taking time to explain.. Your approach is good too..
I was able to fix my problem thru parameters' approach.
I will explain how I accomplished it. I thank LBass for giving me the direction.
************************
Suppose we have the following fields
Customer Product Sale_Date Amount
Assuming user selects 2 fields out of 4 fields, say Customer and Sale_Date and does not select Product and Amount
so output should be
Customer Sale_Date (no spaces) and not like as shown below
Customer Sale_Date
1)In the crystal reports I created 4 parameters
Param1, Param2, Param3, Param4 of Type string. I set the default value for the parameters to a single space " ". Did not include the double quotes.
2)In Vb wrote the following
report.parameterfields.getitemname("Param1").addcurrentvalue "Customer"
report.parameterfields.getitemname("Param2").addcurrentvalue "Sale_Date"
3) In the crystal reports create 4 formulas
//@formula1
Select {?Param1}
Case "Customer":{table.Customer_Name}
Case "Product" :{table.Product_Name}
Case "Sale_Date" :totext({table.Product_Name},"MM/dd/yyyy")
Case "Amount" : totext({table.Amount},2)
default: ""
Just repeated this in the other formulas with different param#. Put the formulas in the detail section. Put {?Param#} in the header section. Suppress column header, db fields
This just works perfect.