D
Diane Mountford
This seems like it ought to be pretty simple, but I'm stymied.
I'm transitioning between two forms using a command button. Form1
shows all the information about a certain Committee of our company.
Form 2 is an unbound form allowing the user to select multiple
parameters for a report. One of the parameters on form2 is a
multi-select list box of all Committees. What I'd like to do is that
if the user clicks the command button on form1 while in the Finance
Committee record, to have the Finance committee selected in the list
box on form2.
The closest thing I've found thus far is the following code ... but it
doesn't work (at least not in the OnClick event for the command
button):
Dim varNumber as Variant
For Each varNumber In Form2.ListBox
If Form2.ListBox.ItemData(varNumber) = Form1.CommitteeID Then
Form2.ListBox.Selected(varNumber) = True
End If
Next varNumber
Note that I want to keep this code in Form1 because there are other
ways to access Form2 when I do NOT want to select anything in the list
box.
Any thoughts would be greatly appreciated.
Cheers,
Diane
I'm transitioning between two forms using a command button. Form1
shows all the information about a certain Committee of our company.
Form 2 is an unbound form allowing the user to select multiple
parameters for a report. One of the parameters on form2 is a
multi-select list box of all Committees. What I'd like to do is that
if the user clicks the command button on form1 while in the Finance
Committee record, to have the Finance committee selected in the list
box on form2.
The closest thing I've found thus far is the following code ... but it
doesn't work (at least not in the OnClick event for the command
button):
Dim varNumber as Variant
For Each varNumber In Form2.ListBox
If Form2.ListBox.ItemData(varNumber) = Form1.CommitteeID Then
Form2.ListBox.Selected(varNumber) = True
End If
Next varNumber
Note that I want to keep this code in Form1 because there are other
ways to access Form2 when I do NOT want to select anything in the list
box.
Any thoughts would be greatly appreciated.
Cheers,
Diane