List Box Question

jcruzAME

Registered User.
Local time
Today, 13:21
Joined
Oct 5, 2011
Messages
135
If I have a listbox, is there a way to code that when you double click on an item in the listbox, it takes the information in that row?

I want to click on a row and have it grab the information, and then open another form and display all the information for that object (that part I'm pretty sure I know how to do).

Thanks in advance.
 
yes, after creating the list box, go to the double click event and write your code there.

Code:
Dim rs As DAO.Recordset

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[ContactID] = " & Me![cboContact] & ""
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Make the necessary changes so this code references your fields, controls, forms, etc. You could have the double click event open the form. On form open, place this code in the open event and this should do the job. I have not tested this but I think this should do the job, though without seeing your database I can only guess.
 
Thanks for the feedback! Yeah, I found a piece of code that loops until i is equal to the selected row. Not sure if that's more or less efficient that what you've posted.
 

Users who are viewing this thread

Back
Top Bottom