What can you learn here ? Select worksheets to copy, Choose selected columns, cDataSets filtering capability
Copying partial tables between sheets
Get the cDataset.xlm from here
By now you are probably familiar with the cDataSets classes. Here is a straightforward implementation that provides a form you can use to select fields in a table to be copied to other sheets. It should demonstrate how versatile applications can be built in a very short time.
The control form.
This is the fFilter form in cDataSet.slsm, and allow you to
Creating the list of fields on a worksheet
When a worksheet is selected, we clear the listboxes and filter fields, which are dependent on which worksheet is selected, and we create a new dataset based on the newly selected worksheet. Finding which column headings are present in the sheet then becomes a simple iteration through the .Headings property. By default these are all assumed to be fields to copy, so they are added to the selected listbox. The .populateData method is restricted to only read 1 row here, since we are only interested in the headings at this point and don’t need to waste time reading the data.
Selecting and deselecting the fields to be copied
By default, all fields are in the right hand list box meaning that they will be copied from the old sheet to the new sheet. The < and > command buttons allow this behavior to be modified by moving fields between the ‘available’ and ‘selected’ listboxes.
This is how to move selections between two listboxes that have been set to allow multiple selections.
Finally this is what happens onSubmit. This time .populate data reads all the data in the input worksheet. The .bigCommit method has all the capabilities to copy from a data set to some other set of worksheet cells, and also knows how to apply the selected filter to only copy over qualifying records.