Hi,
I am trying to create a SQL selection in ASP where the search terms are defined by the values posted in checkboxes from the form on the previous page.
It is used in an email newsletter application. There are several mailing lists on the system and the newsletter administrator needs to be able to check boxes in the form to select which mailing lists he wants to send the email too. The results of the form go the next page and from there I need to be able to select the recipients of the email depending on which mailing lists were chosen.
At the moment all the checkboxes in the form are called "idlist". If only one checkbox is checked, the following SQL query works fine
mySQLe="Select DISTINCT listrecipients.idemail FROM listrecipients WHERE listrecipients.idlist="&idlist &" ORDER by listrecipients.idemail asc"
If the user checked the box for list 1 then the SQL query chooses all recipients on list 1 and it works OK.
But when more than one checkbox is checked on the form the value for "idlist" becomes "1,2" . I need to be able to choose recipients on lists 1 and 2, but the SQL query is looking for a list called "1,2" which obviously doesn't exist.
Can anybody suggest how I can make the query search lists 1 and 2 ?
Many thanks,
Rupes