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

How to Create an Array of Records

Status
Not open for further replies.

BitCounter

Programmer
Feb 18, 2000
28
US
All:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks for reading this.&nbsp;&nbsp;I am looking for help on creating an <b>array of records</b>.&nbsp;&nbsp;The array would be based on 2 fields from a recordset.&nbsp;&nbsp;I want to count the occurrence of data in a particular field.&nbsp;&nbsp;For example, say I wanted to count the number of records with a particular fruit.&nbsp;&nbsp;Upon examination of each record, the program would examine the array, if the fruit already existed in the array, the count would simply be increased, otherwise the &quot;new&quot; fruit would be added to the array.&nbsp;&nbsp;The the end of the recordset, I would simply print out the contents of the array.&nbsp;&nbsp;From this information, I could then generate a report.&nbsp;&nbsp;It would be something like this:<br><br>&nbsp;<b> Fruits&nbsp;&nbsp;&nbsp;Count </b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Apples&nbsp;&nbsp;&nbsp;&nbsp;12<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bananas&nbsp;&nbsp;&nbsp;&nbsp;6<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Oranges&nbsp;&nbsp;&nbsp;&nbsp;9<br><br><font color=red> Any help would be greatly appreciated! </font>
 
Dear BitCounter,<br><br>You refer to a 'Recordset'. If indeed you are obtaining your data from a SQL database then I would suggest using SQL to produce your desired counts.<br><br>&quot;But, that's just my opinion... I could be wrong&quot;.<br>-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top