pull email from subform table

YouMust

Registered User.
Local time
Today, 07:01
Joined
May 4, 2016
Messages
106
howdy guys wonder if it possible for help here,
I have a form for a our customer with a subform in it. In that subform is a table for adding contact details for various representatives.

I've written some code to generate and email with a report but I can't seem to figure out how to pull the email from one of the contacts.
the email box is called pemail as are all of them.
would it be possible to pull the email from the box that is highlighted?
as cant be sen in the image u can select the contact leaving an arrow in their row.



sorry cant direct post images due to post count limit

sorry im trying to post my code but this website says theres links and blocking the post,
 
link to code

176.31.181.34/Temp/Sprint/mail.txt

link to image
176.31.181.34/Temp/Sprint/Capture.JPG

the filter thats stops links being posted stopped me from posting my code but didnt stop me posting links.
 
Oh right ok thank you.

I've added the links above so it's not particularly important anymore now
 
if EmailButton is in the main form:

Private Sub EmailButton_Click()

Dim strTo As String
Dim strSubject As String
Dim strMessageText As String

Me.Dirty = False

'Look for email, return error if missing
If IsNull(Me.subformName.Form!Email) Then
Dim Output As Integer
Output = MsgBox("There is no email for this customer", vbCritical, "User Alert!")
Exit Sub
Else

strTo = Me.subformName.Form!Email
strSubject = "Legal Notice"
strMessageText = "Please find attached a legal notice."
strMessageText = strMessageText & "message text"
DoCmd.SendObject objecttype:=acSendReport, _
objectname:="rptAcLegalMail", _
outputformat:=acFormatPDF, _
To:=strTo, _
Subject:=strSubject, _
Messagetext:=strMessageText, _
editmessage:=True
End If

End Sub

*** supply the correct subform name and email control name in subform.
 
+1 arnelgp

I was just reading about that!

thanks arnelgp for your super fast, helpful reply, its now working perfectly
 

Users who are viewing this thread

Back
Top Bottom