ItemSelected - got a Compiler "not defined" error

G

Guest

Hi,
I am trying to assign a value from a list to a text box.
The list has 2 columns, and is set to multi-select.
I got a compiler error running the procedure below:
(Compile error: ... Function not defined.
The debugger highlights the function "ItemsSelected" in the procedure.)

The procedure I used to assign the list value to the textbox is:

Private Sub Sum_Click()
Dim frm As Form, ctl As Control
Dim varItm As Variant, intI As Integer

Set frm = Forms!Form1RunQuery4A1
Set ctl = frm!SITECRRTLIST
Sum.Value = ctl.Column(0, ItemsSelected(0))
End Sub

David
 
A

Allen Browne

What happens if you declare a list box rather than merely a control:
Dim frm As Form, ctl As Listbox
 
D

Douglas J. Steele

ItemsSelected isn't a "stand along" collection: it belongs to a specific
control.

See whether the following works:

Sum.Value = ctl.Column(0, ctl.ItemsSelected(0))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top