View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default List box with 2 columns

Hi Nath,

Here is a simple example. First, set the ColumnCount property of the listbox
to 2

With ListBox1
.AddItem rst.fields(x).name
.List(.ListCount - 1, 1) = rst.fields(x).type
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Nath" wrote in message
...
Hello

I am populating a list box with the field names from a
recordset from an access database using an Excel form in
VB. However, i have done the part that populates the
field names, now i wish to have a 2nd column that contains
the fields data type. How do i add items, currently i
have:

userform1.listbox1.additem rst.fields(x).name

i also want to add alond side its name

rst.fields(x).type.

How do i add them so the field name is column 1, and the
type is column 2.


TIA

Nath.