Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default opening value in Listbox (2003/2007)

    How can I can set the default value of an unbound listbox on my opening form using the onopen event? Just me.listbox0.setfocus is not enough.
    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Default opening value in Listbox (2003/2007)

    You can set its Value property to the item you want to be selected.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Default opening value in Listbox (2003/2007)

    Thanks
    I tried that, but I need the listbox selected since it is the source for a parameter for queries. This does not seem to be enough. It has to be the equivalent of being clicked and highlighted

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Default opening value in Listbox (2003/2007)

    There should be no need for the list box to have the focus. A query can refer to a control on a form whether it has the focus or not, as long as the form is open.

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Default opening value in Listbox (2003/2007)

    Setting the value property of the listbox in the onload event should make the relevant row highlighted. It does for me.
    Regards
    John



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •