multiple column listbox

  • Thread starter Thread starter PJFry
  • Start date Start date
P

PJFry

Private Sub On_Some_Event()
Me.ListBoxName.RowSource = "SQL Statement"
End Sub

When do you need to set the list to blank?-
 
Hello all,

I have troubles finding the right method to populate a multiple column
listbox with VBA code. Can some one drop me a few lines of code showing the
trick to do so. Aswell how to clear the entire content of the same listbox
from all data.

Thx alot.
Ludovic
--
 
I like to populate the listbox with data wich is generated from Windows
directory information, i can not use the SQL format, unless I first create a
table with the data generated.

Is there not such a thing as:-

me.lstFiles.AddItem.Column(0) = stgName
me.lstFiles.AddItem.Column(1) = stgSize
me.lstFiles.AddItem.Column(2) = stgDate

or

me.lstFiles.AddItem = stgName; stgSize; stgDate (more or less like the value
list)

Because of this method, which I hope to get working, I need to clear the
list before I add newly generated data (in case a file was added or removed
from the directory).

Unfortunatly I am not able to find the rightious method for this.

Thx, for any directions given.

Ludovic

PJFry said:
Private Sub On_Some_Event()
Me.ListBoxName.RowSource = "SQL Statement"
End Sub

When do you need to set the list to blank?-
 
Vsn said:
I like to populate the listbox with data wich is generated from Windows
directory information, i can not use the SQL format, unless I first create
a table with the data generated.

Is there not such a thing as:-

me.lstFiles.AddItem.Column(0) = stgName
me.lstFiles.AddItem.Column(1) = stgSize
me.lstFiles.AddItem.Column(2) = stgDate

No, you can't fill an Access listbox in this way.
or

me.lstFiles.AddItem = stgName; stgSize; stgDate (more or less like the
value list)

That will work (just remove the equals sign), because all that the AddItem
method does is build a semicolon-separated list in the listbox's RowSource.
You don't have to use AddItem - you could just fill the RowSource manually.
This can be handy when you already have a delimited list or array.
Because of this method, which I hope to get working, I need to clear the
list before I add newly generated data (in case a file was added or
removed from the directory).

Unfortunatly I am not able to find the rightious method for this.

Me.ListBoxName.RowSource = ""
 
Stuart, thanks for the suggestions, I got it sorted out.

me.lstFiles.AddItem "" & strFileName & "; " & Nz(fDate, "") & "; " &
Nz(fSize, "") & ""

Ludovic
 
Back
Top