Create email in Outlook

T

Tony Williams

I have a form that has a tick box control which opens Outlook and carries
data from my database to a new email message. I am having problems capturing
a control on a subform to go on the email. All the other controls appear.
Here is my code for the email body
oM.Body = "Please upload this document to Online " & vbCrLf & vbCrLf _
& "Document Number: " & Me.Docnumtxt & vbCrLf _
& "Document Name: " & Me.DocNametxt & vbCrLf _
& "Author: " & " " & Me.DocAuthortxt & vbCrLf _
& "Document URL: " & " " & Me.DocURLtxt & vbCrLf _
& "Document Description: " & " " & Me.MemDocDesctxt & vbCrLf _
& "Group: " & " " & [Forms].[frmGroupListsnewsubform].[CommNametxt]

It's the last linethat is causing the problem. I get a message to say that
Access can't find the form?
I've tried ! instead of full stops and added the main form name first but no
luck.
The error message I get also is "Error 438 Object doesn't support this
property or method"
Anyone help here?
TIA
Tony Williams
PS I think it's time I asked other newbies like me to give a huge round of
applause for the guys that help us on here. I've posted dozens of questions
and nearly always got an answr, an unbelievable resource!!!!
 
G

Gerald Stanley

As the control is on a subform, it is not available through
the forms collection as a form in its own right. If my
memory serves me correctly, neither is it available through
the Controls collection of the form in which it is found.
(If it were, the syntax for that would be
Forms!formName!subFormName!controlName)
In order to access the value of the subform control outside
of the form, you will probably need to put an invisible
control on the main form and update it with the value of
the control on the subform.

Hope This Helps
Gerald Stanley MCSD
 
J

John Vinson

& "Group: " & " " & [Forms].[frmGroupListsnewsubform].[CommNametxt]

It's the last linethat is causing the problem. I get a message to say that
Access can't find the form?

You need to get at it via the main form. The syntax is very
persnickety: you need to use the Name property *of the Subform
control*, the container for the subform; this is not necessarily the
same as the name of the form within that control. Try

Forms![mainformname]![sbfrmGroupList].Form![CommNametxt]

using of course the names of your main form and subform control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top