Listbox

steveboydon

Registered User.
Local time
Today, 23:37
Joined
Jul 21, 2011
Messages
17
Hi,

I am trying to fill a two column listbox, Access version not the MSFORMS.

Have code as

Dim lst as listbox

set lst = me.listbox1

with lst

.additem (strText,1)
.column(1,2) =strMoreText
End With

I'm not sure if this is a quirk, but the code runs fine when the listbox is a MSFORMS version and using the list method.
However, even with list type being a valuelist it throws an object error

I can of course get it to work when I set the rowsource to table and use

lst.rowsource = "tbl_name"

Is this a 2007 anomolie

Steve
 
Not sure why you're trying to reference the .Column property here. All you need to do is delimit the values in the string with a semi-colon.

If I have a two column list box with the values;

1 January
2 February
3 March


and I do this;

Code:
With Me.List1
    .AddItem ("4;April")
End With

Now I have;

1 January
2 February
3 March
4 April


Maybe I'm missing something in your question?
 
ahhh bingo I tried this, but must have had blurry eyes. I think I did

.additem ("4";"April")

I then went off on a tangent and tried everything, I could think of.

It made it worse as I couldn't use set the recordsource to a recordset.

cheers

Steve
 

Users who are viewing this thread

Back
Top Bottom