Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unbound List Box

Status
Not open for further replies.

EllieFant

MIS
May 15, 2001
513
0
0
US
Hi,

I am making a Training Class and Required Reading Tracking database. With all that I am learning I wanted to give a try to something a bit more sophistication.

I am working with unbound form called frmUpdateEmployee. On this form I have two Unbound Listboxes (DepartmentList and EmployeeList) and a subform called subfrmEmployeeInfo.

I have finally got it to work so that I can click on a department in the DepartmentList and an Employee’s name comes up in the EmployeeList and when an Employee’s name is clicked on, all their information appears in the subfrmEmployeeInfo.

I have the default value of both list boxes set to [DepartmentList].[ItemData](0) and [EmployeeList].[ItemData](0) which works great when I first open the form. The problem I am having is when I click on a department that is not the default. The EmployeeList updates with the employees in that department (have the on click event for both list boxes set to me.refresh), but an employee isn’t selected by default from the EmployeeList box.

How do I get my list box to set its focus on the first found item in this list with each and every update.

Hope I haven't been too confusing. Thanks in advance for any help you can offer me in getting this fixed.
Ellie
**Using Access 97**

lena.wood@wgint.com (work)
elliefant@starband.net (home)
 
Checking my post from home and it appears that no one has an answer for me. Maybe this can't be done.

Ellie
 
Hi Ellie!

After your command to requery the list box use this:

Me!YourEmployeeListBox.Selected(0) = True

hth
Jeff Bridgham
bridgham@purdue.edu
 
That made the first item in the Employee List chosen, but after choosing a different department, I can't choose any person but the first one (and their record doesn't show up in the subfrmEmployeeInfo).

Thanks for trying to help. Ellie
**Using Access 97**

lena.wood@wgint.com (work)
elliefant@starband.net (home)
 
Hi Ellie!

Could you post the code you are using and the events it is in? Might be able to help with that information.

Jeff Bridgham
bridgham@purdue.edu
 
The only code I have is the On Click code for each listbox. The code is me.refresh.

The default value for unbound listbox is [DepartmentList].[ItemData](0) and [EmployeeList].[ItemData](0).

I have no other code for my unbound listboxes. On my subform I have the on current set to me.refresh

That is all the code I have for this form. Maybe that is my problem.
Ellie
**Using Access 97**

lena.wood@wgint.com (work)
elliefant@starband.net (home)
 
Hi!

Try being more specific. In the click event of the Department list box requery the employee list box, select the first employee and requery the subform. In the click event of the employee list box just requery the subform.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top