Listing Field Descriptions in List Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two list boxes on a form. One lists the tables in the database, the
second lists the corresponding fields of the table selected in listbox 1.

However, field names are short and difficult to understand. How can I have
the second list box list what is typed in the 'field description' field of
the table in design view (ie. A longer more complete field name)????

Any suggestions would be greatly appreciated....
 
I see that the answer is in there somewhere, but I'm not sure how to use it.
The way my form works now is to set column 2 of list box one (the hidden name
of the table as it exists in the db) as the rowsource of list box two, set to
field list for rowsource type.

If I used this function, where would I put it and how could I get it to pass
the descriptions on to listbox2???

Sorry, my knowledge of Access is quite limited.
 
You will need to write your own function to get the the Field names and
descriptions into the list box.

The article explains that the Description property does not exist for fields
that have no description, and illustrates how to recover from the error and
list the descriptions beside the field names.

To adapt it, you could return a comma-delimited list of field names and
descriptions, inserting a zero-length string for the fields that have no
descriptions. You could then set these properties for your list box:
RowSourceType Value List
Column Count 2
Column Widths 1;2
RowSource assign the string to this property

For instance, if you had another combo where the user selects what table to
use, its Afterupdate event procedure would assign the function's return to
the combo of field-and-description names.

You will need to know some VBA to achieve that, but it's just a matter of
looping through the field and description names (exactly as the samle does),
and building up a string in place of the Debug.Print line.
 
Right on...works like a charm.

Thanks Allen.


Allen Browne said:
You will need to write your own function to get the the Field names and
descriptions into the list box.

The article explains that the Description property does not exist for fields
that have no description, and illustrates how to recover from the error and
list the descriptions beside the field names.

To adapt it, you could return a comma-delimited list of field names and
descriptions, inserting a zero-length string for the fields that have no
descriptions. You could then set these properties for your list box:
RowSourceType Value List
Column Count 2
Column Widths 1;2
RowSource assign the string to this property

For instance, if you had another combo where the user selects what table to
use, its Afterupdate event procedure would assign the function's return to
the combo of field-and-description names.

You will need to know some VBA to achieve that, but it's just a matter of
looping through the field and description names (exactly as the samle does),
and building up a string in place of the Debug.Print line.
 
Back
Top