Full Version: select two records in simple listbox
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
whedlund
I have created an unbound simple listbox (multiselect) for users. When they open the form I would like the first two options (rows) to already be selected in the listbox (that is, they are both highlighted). I tried using the default value control but couldn't get it to work. I'm sure it's fairly simple. Any ideas? Thanks!
Doug Steele
You can't do it using default values.

In the form's Load event, put logic to toggle the Selected collection:

CODE
Private Sub Form_Load()

  Me!MyListbox.Selected(0) = True
  Me!MyListbox.Selected(1) = True

End Sub


(Note that numbering starts at 0, not 1)
whedlund
Beautiful. I knew it would be easy. Thanks so much! W~
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.