Roger's Access Library Homepage
Forum Home Forum Home > Other Download Libraries > MS Access MVP Libraries > Tejpal, A.D.
  New Posts New Posts RSS Feed - DatasheetDynamicColumns.mdb
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Please consider donating $1 per sample downloaded, (find out why here)


 Post Reply Post Reply
A.D. Tejpal View Drop Down
Microsoft MVP
Microsoft MVP

Joined: 30 Jun 2008
Status: Offline
Points: 192
Post Options Post Options   Thanks (0) Thanks(0)   Quote A.D. Tejpal Quote  Post ReplyReply Direct Link To This Post Topic: DatasheetDynamicColumns.mdb
    Posted: 09 Jul 2008 at 10:56pm
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: uploads/37/


Back to Top
Sponsored Links

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.