oMail - adding changing merge fields to vba code from database form -
i basic user , i've set command button, on click send email. far, have managed make work point can send email particular email address in database, have stored field 'servicecontact' , want able send email address specified in field. insert merge fields email body specify email relating to
this code have used far
private sub receipt_confirmation_email_click() dim oapp outlook.application dim omail mailitem dim rs dao.recordset set oapp = createobject("outlook.application") set omail = oapp.createitem(olmailitem) set db = currentdb set rs = db.openrecordset("select * [checks]", dbopendynaset) omail.body = "re <insert field name here>" omail.body = omail.body & " " omail.subject = "confirmation email" omail.to = {{{{this section struggling format}}}} omail.sentonbehalfofname = "specific@emailaddress.org" omail.send set omail = nothing set oapp = nothing end sub
any might able give me gratefully received.
thank you
you can refer form in code, example:
omail.to = forms!checks!servicecontact
you may need check servicecontact
not null.
if code run on form checks
, can use
me.servicecontact
Comments
Post a Comment