Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Nov 2002
    Location
    Farnborough, Hampshire, England
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select first row of ListBox (97 SR-2)

    Hi everyone!

    I have a simple form with a ListBox for selecting which record to view. This works fine, but when the form is first opened nothing is selected in the ListBox. I'd prefer that the first row of the ListBox was selected automatically, then the corrsponding record found.

    However I try to code this functionality, it doesn't work in some way. Does anyone have any suggestions?

    Thanks!

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

    Re: Select first row of ListBox (97 SR-2)

    You don't need code for this. Say that your list box is named lstNames. Set the Default Value property of lstNames to

    =[lstNames].[ItemData](0)

    (items are numbered starting at 0, so 0 indicates the first item)

  3. #3
    Lounger
    Join Date
    Nov 2002
    Location
    Farnborough, Hampshire, England
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select first row of ListBox (97 SR-2)

    Thanks a lot, Hans!

    For anyone else with a similar problem, the only other thing I had to do was to call the ListBox's AfterUpdate event from the form's Activate event. This then found the record specified by the ListBox.

Posting Permissions

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