Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

listbox

Discussion in 'Information Technology' started by PeterM, Nov 3, 2005.

Tags:
  1. PeterM

    PeterM
    Expand Collapse
    Guest

    I'm running AC2002.

    I have a listbox on a form. When a user clicks on an entry in that listbox
    some additional information is displayed on the form. The listbox can have
    several entries and I want the form to open with the first entry in the
    listbox selected and the additional information displayed. In the Open form
    event I put

    me.listbox1.selected(1) = true
    (populate form with additional information)

    When I run the form the first entry in the listbox is selected and the
    additional information is displayed as expected. The problem is that I can't
    select any other entries in the listbox. When I click on a listbox entry the
    new entry selected's info is not displayed and the event does not fire....why?

    Any help would be appreciated.
     
  2. xRoachx

    xRoachx
    Expand Collapse
    Guest

    Hey Peter, the statement: me.listbox1.selected(1) = true, selects the second
    item in the list. This is why it is selected when you open the form. Also
    check the properties for the listbox to determine if multiselect option is
    set to simple or extended (Other tab). To check if the first item is
    selected, try:

    If me.listbox1.selected(0) = true Then
    'DISPLAY INFO
    End If

    Also, if you want the information to be displayed for each record where the
    first item is selected, move the code to the AfterUpdate Event of the
    listbox.

    "PeterM" wrote:

    > I'm running AC2002.
    >
    > I have a listbox on a form. When a user clicks on an entry in that listbox
    > some additional information is displayed on the form. The listbox can have
    > several entries and I want the form to open with the first entry in the
    > listbox selected and the additional information displayed. In the Open form
    > event I put
    >
    > me.listbox1.selected(1) = true
    > (populate form with additional information)
    >
    > When I run the form the first entry in the listbox is selected and the
    > additional information is displayed as expected. The problem is that I can't
    > select any other entries in the listbox. When I click on a listbox entry the
    > new entry selected's info is not displayed and the event does not fire....why?
    >
    > Any help would be appreciated.
     

Share This Page