Hi, i am trying to create a string of email addresses that I can use as part of a send email script I have. I am trying to base the recordset off of a select statement, but I get the error "To Few parameters. Expected 1" with the "Set cList = db.OpenRecordset(strSQL)"
Here is my Code :
Public Sub emailList()
Dim db As Database Dim cList As Recordset
Dim strSQL As String Dim toList As String Dim ccList As String
This is how I would handle this. My SQL statement is simplified as I am only selecting the Email field from my customer table. Obviously, you would need to modify this for your needs. See screenshot below.
Kevin Robertson
Chris Pardy
Hi Kevin thanks.. This works, but now my problem is if my SQL has a variable in it, it breaks.. From what I can google I need to use something called querydef in order to have a control or variable as part of the sql statement.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Using Recordsets.
The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.