Solved

Getting the row number in an Access listbox

Posted on 2012-03-18
1
248 Views
Last Modified: 2012-03-31
Hi All -

I have an unbound listbox and I nered a way to identify the row number that the user just selected.

I then want to take that number and advance the cursor to the next row when a button is pushed and make the Listbox highlight the next item and then fetch the underlying data.

Lenny
0
Comment
Question by:LennyGray
1 Comment
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 500 total points
ID: 37736367
To get the selected item use the .ItemsSelected propery. See: http://msdn.microsoft.com/en-us/library/aa196172%28office.11%29.aspx

Also check out the ItemData Property at http://msdn.microsoft.com/en-us/library/aa196159%28office.11%29.aspx


To select an item use:

if X = current selected item then use this to select the next row

If X < Me.ListBox.ListCount 
   Me.ListBox.Selected(X + 1) = True
End If

Open in new window

0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This very simple solution applies to a narrow cross-section of the "needs to close" variety. In this case, the full message in Event Viewer was in applog, Event ID 1000: Faulting application iexplore.exe, version 8.0.6001.18702, faulting module …
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now