List Box in MS Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can i get the value of selected item in the listbox using VBA??

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...d33b&dg=microsoft.public.access.modulesdaovba
 
Value is the default property of the listbox so:
someVariable = Me.lstListBox

Alternatively you could reference it explicitly with the ItemData property.

These will return the value of the *bound* column. If you want the data from a
different column then you would use the Column property. Columns are numbered
from 0 so:
someVariable = Me.lstListBox(1)
would return the value in the second column of the selected item.

Looking up ListBox in Help returns a wealth of information.

HTH,
RD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top