The reference to the control in the form does not work!!

R

ria

Thankyou for all your help withmy previous posts...The
code I have below used values from a multi-select field
and puts it in a text box. It works until that point. If
I select a single item, the query works. The query does
not work when I select more than one items in the multi-
select list.

I have searched and found that I could pass the whole
select statement from the code...I have been able to
create the code but am not sure how I would launch the
query.....


Private Sub List14_Exit(Cancel As Integer)
Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim strSQL As String

Set frm = Forms!DateRangeDialog
Set ctl = frm!List14

For Each varItem In ctl.ItemsSelected
strSQL = strSQL & ctl.ItemData(varItem) & Chr$(34)
& "," & """"
Next varItem

strSQL = Left$(strSQL, (Len(strSQL) - 3))

Me!Text19 = strSQL
End Sub
 

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

Top