Select Statement Array Trouble

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Keith Boesker
    New Member
    • Dec 2010
    • 14

    Select Statement Array Trouble

    I have a newsletter program I'm trying to use a group list like 1,2,3,4 in my database to send email to one or more groups. So I get the groups say 1,2 but when I try to get the email address from a user say in group 1 I get nothing. I believe it not finding the 1 in the list of 1,2,3 if the user is in those groups. Here's what I have:

    Code:
    NMGroups = Replace(UploadFormRequest("txtGroup"), " ", "") 'remove white space
    
    
    strSQL = "SELECT * FROM NewsletterMembers WHERE NMActive = 'True' AND NMGroups IN ('" & NMGroups & "')"
    Set sendemails = database.Execute(strSQL)
    Thanks for your help in advance!!!!
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    If it's numbers, you don't need quotes. If they're strings, you need to demarcate each distinct value with single quotes.

    Comment

    Working...