ms access - How make appears a field from the field list automatically? -
i started use access vba. have table roles, years , workload of each role in specific year. each record in table idrole, idyear,workload (number). display table in form doing crosstab table years in columns , roles in rows. number of years can increase.
my problem when add new years , display in columns, doesn't appear in form have select field list manually know if there way in vba when form load, automatically appears new columns (years).
i misunderstood situation. form's crosstab data source table instead of query. , add columns table, want new columns automatically appear in form when next open form.
in case, use approach described below, selected query (query.qryfoo2) in source object dropdown, choose table ... table.yourtablename ... in dropdown.
the last 2 paragraphs below apply whether data source table or query.
if have crosstab query saved named query, can use source object subform control.
then when switch design form view, query results displayed in datasheet view within subform control.
as number of columns changes on time, datasheet view can "automagically adapt" display them ... same if opened named query directly in datasheet view.
as far i'm aware, there no other reasonably simple way accomplish want. if suggestion not suitable, can explore programmatically adding bound data controls existing form after examining set of fields query returns. way effort imo.
Comments
Post a Comment