Using form Listbox to select query fields/columns

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mfletcher
    New Member
    • Dec 2008
    • 4

    Using form Listbox to select query fields/columns

    Hi

    I have a query which calculates a large number of fields for each record, i don't want all of the fields present in the datasheet view only those fields selected by the user in a list box(or similar).

    Therefore, how can i add a list box (field listing of a table/query) to a form from which the user can select which of the available fields they want to see in the query output (i.e. has the same effect as checking/unchecking the "Show" checkbox for each field on the standard query design grid)?

    I think i need to build the query on the fly using the fields selected from the list box as the column headings / or make those selections turn on the "Show" checkbox in the design grid (this is only a guess). But don't really know where to start.


    Any help gratefully received.
    Regards
    Mark
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    You can use the ColumnHidden property of the fields in the datasheet to hide/show the appropriate fields.

    SubformControlN ame!FieldName.C olumnHidden = -1

    ColumnHidden Property [Access 2007 Developer Reference]

    Comment

    Working...