This sample db demonstrates manipulation of datasheet columns (their
numbers, headings, control-source, column order, width etc) so as to suit run-time
change of record-source.
On opening the main form, it grabs the names of all available tables and queries,
and loads them in the row-source for the combo box. At this stage the main subform
has five columns on display, all unbound, with generic headings. There is no record-
source yet, for the subform.
As soon as a source table or query is selected in the combo box, the subform at
right (serving as field list), gets populated with names of fields in the selected
table/query. Out of these, the user can click the check boxes for selecting the
fields required to be loaded in the main subform.
On clicking the update button, the subform gets loaded with appropriate record-
source and the controls get bound to respective fields. The columns are displayed
in proper order, with headings matching the field names. If the number of fields
selected in the field list is less than the number of controls available, the unused
columns remain unbound and get hidden. Widths of displayed columns get adjusted
automatically, so as to match the overall width of subform control.
References - DAO 3.6 Download Access XP & 2K: http://www.rogersaccesslibrary.com/forum/uploads/37/DatasheetDynamicColumns.zip - uploads/37/DatasheetDynamicColumns.zip
------------- --
Email: mailto:adtejpal@gmail.com - adtejpal@gmail.com
|