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!

Printing records as a delimited list

Status
Not open for further replies.

rizvir

Programmer
Aug 7, 2000
12
TH
Hi all,

I am using VB6 SP5 and CR7 to print a list of countries from a table COUNTRIES in a database MYDB in Access 97. The table has just one field C_NAME and each country name is a separate record. I want the printed output to be as follows:

Argentina, Afghanistan, Angola, Bahrain, Bogota....

I am at the moment getting only this:
Argentina
Afghanistan
Angola
Bahrain
Bogota....

Any help would be most appreciated. Thanks
Rizwan.
 
You can concatenate these by initiating a stringVar and appending as you pass each record. The result can be printed at the end of the report.

Something like a running total:

WhilePrintingRecords;
StringVar Mylist;
MyList := MyList + ', ' + {country}

Place on detail band to accumulate.

Place the following to display on report footer:
WhilePrintingRecords;
StringVar Mylist;

However, a StringVar can only hold 254 characters, and appears that you will go over that. You might need to have several StringVars in the report for different ranges of names, and then you can drop the resulting pieces into one large text object. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Good advice of KenHamady.
Also, jump to CR 10 and you won't have this String limitation
BTW Bogota is not the country.
This is the Capitol of Colombia


Seva Akkerman

ssakkerm@juno.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top