Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2004
    Posts
    56

    Cool Unanswered: Selecting a record from a list box

    Once a list box has recovered its data from a query and has produced that list in a form, is there away of enabling a user to double click that reocrd to select it and go to that record on another form? (Using Access 2003)

    Many thanks


    Col_Bol

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Post

    To get the selected Value of the list box use

    Me.yourListBox.Column(0, Me.yourListBox.ListIndex)
    This will return your data in the first Column

    Me.yourListBox.Column(1, Me.yourListBox.ListIndex)
    This will return your data in the Second Column

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    Forgot to say, you have to adjust the column number in your list box

  4. #4
    Join Date
    Jul 2004
    Posts
    56

    Some more help, please

    Thanks for the prompt response. This wouldn't actually work, it came up an error stating that it was expecting an "=".

    myListBox brings up information from a query from a master table. The information in that table is inputted from a form. I would like to be able to double click an entry in myListBox and goto the form view of that entry from that table. Is this possible?

    Thanks again

    Col_Bol

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    I'll make a small example to double click a List Box

  6. #6
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Post

    Just double click any item in the ListBox ....
    Attached Files Attached Files

  7. #7
    Join Date
    Jul 2004
    Posts
    56

    Thanks

    Thanks for that example. If you had a form that inputted the data into the table that you created and then another form that brought that list box up. Could you double click that entry in the list box and make that take you to the other form and that particular entry ?

    many thanks Again


    Col_bol

  8. #8
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    Of course you can do that, through DoCmd.OpenForm "yourFormName", , , "[ID]=" & yourListBox.Column(0, List_Info.ListIndex )

    Where ID is a numeric value of your record and it must be at the first column of the listbox

  9. #9
    Join Date
    Jul 2004
    Posts
    56

    More questions

    Sorry to be a pain - and thanks for your help so far !

    This has generated an error 424 -Object Required. I'm not sure what i've done there. I created the Docmd line above in the event 'double-click' on the list box. I replaced the form name with my form name and used the table row identifier for the ID ("Unique Number" in my case) and used my List Box name in the right place - Any more ideas?

    Thanks again

    Col_Bol

  10. #10
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    If you want you can send this part as Acce$$ 97.

Posting Permissions

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