List Box in MS Access

K

Kent

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
 
R

RD

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
 
Top