Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    Jan 2002
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclude first row from list box rowsource (XP)

    I have multselect list boxes that use a field list as the rowsource. Each list box is based on a single table and I want to show all fields except for the primary key. Currently, I have a query set up for each listbox that excludes the primary key. Users, however, may add fields in the future that will have to added to the queries. Is there a way to use fieldlist as the rowsource, but exclude the first row (the primary key) so that I can have the queries show all records in the table (thus updating the listbox automatically if a change is made to the table)? Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Exclude first row from list box rowsource (XP)

    You can populate the list box dynamically in the On Load event of the form. You must set the RowSourceType of the list box to Value List. In the code, open a record set on the table, loop through its fields (excluding the first one) and use the AddItem method of the list box to add the field name.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •