listbox select first value as default - though listbox could be em

H

hannes

Dear All,
I have the following problem.
I have a listbox "called: lst1" which should get updated when I change the
value of another listbox "called: lst2" . This works fine. However I like to
see in as default when I open the form where the listboxes are shown for lst1
always the first available entry. the lst1 ist bound by column 3 if this is
relevant. Also sometimes the lst1 might be empty as it is filled with the
after update property when I change lst2 values. I tried many different
things, but nothing seem to work so far. Any idea?
Thanks
hannes
 
H

hannes

I found the solution - I forgot to put the requery statement above - I had it
after the with statement...

For a single-select listbox:

With lstYourListboxName
.Value = .ItemData(Abs(.ColumnHeads))
End With

If you know it won't have column headers:

With lstYourListboxName
.Value = .ItemData(0)
End With

For a multiselect list box:

With lstYourListboxName
.Selected(Abs(.ColumnHeads)) = True
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top