You are here:

Using MS Access/Stop listbox losing focus

Advertisement


Question
Hello Scott:

I have a listbox on the form to show a number of projects I have in the database. After click on one of the projects, I could go to other forms by click on command button to check details of the project. However, when I come back to the form with the listbox, the listbox will lose its focus. So I need to click on the project again, then go to other forms.Is there a way that could make the focus stay on the project I chosen, unless I click on another project. Thank you!
Br
Moustapha

Answer
Do you mean focus on the control or for the control to retain its value? A control will retain its value until the form is closed or its changed. So, if you return to the form with the listbox, the selected value should not have changed.

If you want to place focus back int he control, you can use the On Activate event to SetFocus to the listbox.

Hope this helps,
Scott<>
Blog: http://scottgem.wordpress.com
Website: http://www.diamondassoc.com
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Education/Credentials
Brooklyn College BA

©2016 About.com. All rights reserved.