Microsoft
Software
Hardware
Network
Question : Retrieve subform control name from Main form
Hi experts,
I have a Main form and I created a button to automatically send an email once user click it. Below is my code:
With OutMail
.To = Me.EmployeeID.Column(3)
.CC = ""
.BCC = ""
.Subject = "New Workorder for " & Me.EmployeeID.Column(1) & ""
.HTMLBody = "<HTML>Dear " & Me.EmployeeID.Column(1) & "<BR>" _
& "<P>A new workorder has been generated: </P>" _
& "<P><B>Workorder ID:</B> " & Me.WorkorderID & "</P>" _
& "<P><B>Description:</B> " & Me.ProblemDescription & "</P>" _
& "<P><B>Date:</B> " & Me.DateReceived & "</p>" _
& "<P>Please review this and take appropriate action.</P>" _
& "<P>" & Me.Parent![tblworkordernot
es_subform
]!workorde
rnoteconsu
ltant.Colu
mn(1) & "</P>" _
.Send
MsgBox ("Email has been sent successfully")
.Sent
End With
I have tested without this line "& "<P>" & Me.Parent![tblworkordernot
es_subform
]!workorde
rnoteconsu
ltant.Colu
mn(1) & "</P>" _" and everything works fine.
When I input the line above, and send a test email, I received a blank email.
I have a subform where:
Source Name: tblworkordernotes subform
Record source: SELECT tblworkordernotes.workorde
rnote, tblworkordernotes.workorde
rID, tblworkordernotes.workorde
rnoteconsu
ltant, tblworkordernotes.workorde
rnotestamp
FROM tblworkordernotes ORDER BY tblworkordernotes.workorde
rID;
and the control source that I want to retrieve is:
Control source: workordernoteconsultant
Row source: SELECT Consultants.ConsultantID, Consultants.[Consultant Name], Consultants.[Active?] FROM Consultants WHERE (((Consultants.[Active?])=
Yes));
I am looking for Consultant Name so it's Column(1)
This is the code I input in the last line:
& "<P>" & Me.Parent![tblworkordernot
es_subform
]!workorde
rnoteconsu
ltant.Colu
mn(1) & "</P>" _
and didn't really work well.
Thanks!
Answer : Retrieve subform control name from Main form
correction, your subform control name does not have an underscore
& "<P>" & Me.[tblworkordernotes subform].Form!workordernot
econsultan
t.Column(1
) & "</P>" _
actually, check what is listed in the Name property of the subform control and use that..
Random Solutions
KeyListener in JTable
Windows 2008R2 static ports for ntds/rpc/ntfrs
Win 7 Pro Virtual Pc XP Mode visible in the network but not accessible
what is the best linux distro and ide for web programming (PHP) ?
AIX DB2 error
Modal Popup Validation Summary
Intel Remote Monitoring Module
SSIS/TSQL Three Part Naming for Temp Table
Sharepoint takes forever to load on first access of the day... How do I fix this?
Replace apostrophes in all Session Variables in C#?