PhilipEwen
Registered User.
- Local time
- Today, 03:05
- Joined
- Jun 11, 2001
- Messages
- 81
Hi,
I have a listbox on a form which is based on a query and shows how which staff members are associated to the client.
I have added a button which opens a form and would allow you to select additional staff to associate.
This form comprises as multi-select list box showing all staff members pulled from a table.
What I am looking to do is to automatically highlight the the staff members in this list box, based on the previous form's list box.
i.e. If Bob and Bill are showing in form contacts_modify then when i open form selected_staff I would like the multiselect list box to already have Bob and Bill selected as this would save the user from highlighting them again.
Here is my code ( based on a few bits i have picked up from here )
I have a listbox on a form which is based on a query and shows how which staff members are associated to the client.
I have added a button which opens a form and would allow you to select additional staff to associate.
This form comprises as multi-select list box showing all staff members pulled from a table.
What I am looking to do is to automatically highlight the the staff members in this list box, based on the previous form's list box.
i.e. If Bob and Bill are showing in form contacts_modify then when i open form selected_staff I would like the multiselect list box to already have Bob and Bill selected as this would save the user from highlighting them again.
Here is my code ( based on a few bits i have picked up from here )
Code:
Dim frm As Form, ctl As Control
Dim vItem As Variant
Dim thisfrm As Form, thisctl As Control
Set frm = Forms!contacts_modify
Set ctl = frm!selected_staff
Set thisfrm = Forms!admin_select_staff
Set thisctl = thisfrm!List0
For Each vItem In ctl.ItemsSelected
thisfrm.thisctl.Selected = True
Next vItem
[code]
Can anyone tell me why this does nothing ?
Many thanks
Phil.