F
Fred
I think that I should treat this like a new question
I posed the below quesion and Paolo was kind enough to provide the below
answer. (Thank you!)
But when I tried it it errored out, saying that there is a syntax error in
the following line:
Set rec_mail = CurrentDb.OpenRecordset("select * from people",
dbopendynaset)
Could you tell me what is wrong / how to fix it?
Thank you very much.
Fred
Hi Fred,
if I've understood well your question create a button and add this code to
the on click event
Dim rec_mail As DAO.Recordset
Dim str_mail As String * 32000
Set rec_mail = CurrentDb.OpenRecordset("select * from people",
dbopendynaset)
tmp_mail = ""
Do While Not rec_mail.EOF
tmp_mail = tmp_mail & rec_mail!emailaddress & ","
rec_mail.MoveNext
Loop
str_mail = Left(Left(tmp_mail, Len(tmp_mail) - 1) & Space(32000), 32000)
file_num = FreeFile
Open "c:\email.txt" For Random As #file_num Len = 32000
Put #file_num, , str_mail
Close #file_num
rec_mail.close
HTH Paolo
I posed the below quesion and Paolo was kind enough to provide the below
answer. (Thank you!)
But when I tried it it errored out, saying that there is a syntax error in
the following line:
Set rec_mail = CurrentDb.OpenRecordset("select * from people",
dbopendynaset)
Could you tell me what is wrong / how to fix it?
Thank you very much.
Fred
Hi Fred,
if I've understood well your question create a button and add this code to
the on click event
Dim rec_mail As DAO.Recordset
Dim str_mail As String * 32000
Set rec_mail = CurrentDb.OpenRecordset("select * from people",
dbopendynaset)
tmp_mail = ""
Do While Not rec_mail.EOF
tmp_mail = tmp_mail & rec_mail!emailaddress & ","
rec_mail.MoveNext
Loop
str_mail = Left(Left(tmp_mail, Len(tmp_mail) - 1) & Space(32000), 32000)
file_num = FreeFile
Open "c:\email.txt" For Random As #file_num Len = 32000
Put #file_num, , str_mail
Close #file_num
rec_mail.close
HTH Paolo