I have to make an mailingapplication on my database.
with a query I select the names. Then i have to transport this to MSword, somebody who have code for me to make this or a place where I can find the code?
tnx in advance ,
gerard
Hi GK22,
Does this need to be done within Access? If you're referring to postal mailing and not emailing, it seems this would most easily be done through Word's Mail Merge.
If, instead, you're referring to automatically sending an email to each of the people in the query, then you could probably use the DoCmd.SendObject action. Iterate through the query, and (if you need to send individual emails) use the SendObject action on each iteration. Otherwise, add the email addresses to a string on each iteration, separating with semicolons, and use SendObject after the iteration is over.
Here's some sample code, which is off the top of my head and therefore not even close to foolproof.. I assume for the sake of the code that the query is called "qryEmails" and the Email field is called "Email".
Code may be slightly different in Access 2000.. this is for Access 97.
Dim dbs as Database, rstEmails as Recordset
Dim strEmails as String, i as Integer
Set dbs = CurrentDb
Set rstEmails = dbs.OpenRecordset "qryEmails"
With rstEmails
If Not .BOF Then
.MoveFirst
Do Until .EOF
strEmails = IIf(strEmails = "","",strEmails & ";" & _
!
.MoveNext
Loop
End If
End With
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.