[ms-access] Retrieve column values of the selected row of a multicolumn Access listbox

How can I retrieve the value of specified column of the selected row in a multicolumn listbox?

I populate the listbox by setting the RowSource property with a SQL string. BoundColumn set to value 1.

I can retrieve the value of the bound column (of the selected row) by using ListBox.Value. But I also want the value of another column.

This question is related to ms-access ms-access-2007 vba

The answer is


For multicolumn listbox extract data from any column of selected row by

 listboxControl.List(listboxControl.ListIndex,col_num)

where col_num is required column ( 0 for first column)


Just a little addition. If you've only selected 1 row then the code below will select the value of a column (index of 4, but 5th column) for the selected row:

me.lstIssues.Column(4)

This saves having to use the ItemsSelected property.

Kristian


Examples related to ms-access

How to get parameter value for date/time column from empty MaskedTextBox Access And/Or exclusions Get length of array? How to pass an array to a function in VBA? How to insert values into the database table using VBA in MS access Access 2013 - Cannot open a database created with a previous version of your application Does VBA contain a comment block syntax? java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver Exception occurring. Why? Manipulating an Access database from Java without ODBC How to find longest string in the table column data

Examples related to ms-access-2007

C# Inserting Data from a form into an access Database How to show row number in Access query like ROW_NUMBER in SQL Import an Excel worksheet into Access using VBA How to refer to Excel objects in Access VBA? Retrieve column values of the selected row of a multicolumn Access listbox Determine whether a Access checkbox is checked or not Now() function with time trim How do I correctly use "Not Equal" in MS Access? A select query selecting a select statement Use SELECT inside an UPDATE query

Examples related to vba

Copy filtered data to another sheet using VBA Better way to find last used row Check if a value is in an array or not with Excel VBA Creating an Array from a Range in VBA Excel: macro to export worksheet as CSV file without leaving my current Excel sheet VBA: Convert Text to Number What's the difference between "end" and "exit sub" in VBA? Rename Excel Sheet with VBA Macro Extract Data from PDF and Add to Worksheet Quicker way to get all unique values of a column in VBA?