G
Guest
I have a multi-select list box on a form with Subscriber ID's (1, 2, 3,...)
and I need to be able to select more than one Subscriber and pass those
selections to a query as criteria to pull records for the selected ID's.
With help from Douglas Steele, I was able to concatenate the ID's into a
string variable named strSQL as the following SQL statement and put it into a
text box on my form: "Select * from Subscribers where [SubscriberID] = 1
Or[SubscriberID] = 2 Or[SubscriberID] = 3 Or...". Next, I went to my query
and in the Criteria row for the SubscriberID field I built the following
expression:=[Forms]![MyForm]![txtStrSQL]. Unfortunately, the query pulls no
records and that's where I'm stumped. I then manually typed the value of
strSQL into the Criteria row and I get this message: "The syntax of the
subquery in this expression is incorrect. Check the subquery's syntax and
enclose the subquery in parentheses. Can anyone see what's wrong here?
Thanks,
Jeff
and I need to be able to select more than one Subscriber and pass those
selections to a query as criteria to pull records for the selected ID's.
With help from Douglas Steele, I was able to concatenate the ID's into a
string variable named strSQL as the following SQL statement and put it into a
text box on my form: "Select * from Subscribers where [SubscriberID] = 1
Or[SubscriberID] = 2 Or[SubscriberID] = 3 Or...". Next, I went to my query
and in the Criteria row for the SubscriberID field I built the following
expression:=[Forms]![MyForm]![txtStrSQL]. Unfortunately, the query pulls no
records and that's where I'm stumped. I then manually typed the value of
strSQL into the Criteria row and I get this message: "The syntax of the
subquery in this expression is incorrect. Check the subquery's syntax and
enclose the subquery in parentheses. Can anyone see what's wrong here?
Thanks,
Jeff