Send email with optional message from combo box?

E

efandango

I want to send emails that include some fields and additonally ask a relevant
question relating to the fields.

I can automatically include the fields in the email body message; but I also
want to select the relevant question from a pre-defined combo list?.

I suspect that because of the limit on parameters for the SendObject
command, I may have to combine the selected question with the output of the
fields. I don’t mind if this is the case, but need some help on how to do the
question selection routine and how to merge the question into the ‘MyMessage’
String.

This is the code I have that will send a ‘fixed message’ to an email
recipient.

Private Sub btn_Email_Point_Request_Click()
Dim SendTo As String, MySubject As String, MyMessage As String
SendTo = "(e-mail address removed)"
MySubject = "Information Required"
MyMessage = "Where Would I find the answer?" & vbCrLf & vbCrLf & Me.[Field1]
& " " & Me.[Field2] & " " & Me.[Field3]
DoCmd.SendObject acSendNoObject, , , SendTo, , , MySubject, MyMessage, True
 
A

Arvin Meyer [MVP]

Your code will work as written. If one of the controls is a combobox, the
bound column will be the one that's concatenated. However, if you want a
different column from the combo, just tell your code that, using a zero (0)
based column count:

MyMessage = "Where Would I find the answer?" & vbCrLf & vbCrLf &
Me.[Field1].Column(1) & " " & Me.[Field2] & " " & Me.[Field3]

Column(1) would be the second column in the combo box, and likely the one
that's displayed.
 
E

efandango

Arvin,

Having thought about your reply, it got me thinking about how i should have
exaplained things better.

I want to be able to select the record to be emailed, and when I hit the
email button, I want a pop up box to appear contianing a combo with a list of
the questions that are relevant to the record. How would I go about doing
that?



Arvin Meyer said:
Your code will work as written. If one of the controls is a combobox, the
bound column will be the one that's concatenated. However, if you want a
different column from the combo, just tell your code that, using a zero (0)
based column count:

MyMessage = "Where Would I find the answer?" & vbCrLf & vbCrLf &
Me.[Field1].Column(1) & " " & Me.[Field2] & " " & Me.[Field3]

Column(1) would be the second column in the combo box, and likely the one
that's displayed.

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


efandango said:
I want to send emails that include some fields and additonally ask a
relevant
question relating to the fields.

I can automatically include the fields in the email body message; but I
also
want to select the relevant question from a pre-defined combo list?.

I suspect that because of the limit on parameters for the SendObject
command, I may have to combine the selected question with the output of
the
fields. I don't mind if this is the case, but need some help on how to do
the
question selection routine and how to merge the question into the
'MyMessage'
String.

This is the code I have that will send a 'fixed message' to an email
recipient.

Private Sub btn_Email_Point_Request_Click()
Dim SendTo As String, MySubject As String, MyMessage As String
SendTo = "(e-mail address removed)"
MySubject = "Information Required"
MyMessage = "Where Would I find the answer?" & vbCrLf & vbCrLf &
Me.[Field1]
& " " & Me.[Field2] & " " & Me.[Field3]
DoCmd.SendObject acSendNoObject, , , SendTo, , , MySubject, MyMessage,
True
 
A

Arvin Meyer [MVP]

Your combo can have a list of questions, but you only get to pick 1 of them.

Create a table with an ID field and the question field. Use that table as
the rowsource for a combo box on the popup form.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

efandango said:
Arvin,

Having thought about your reply, it got me thinking about how i should
have
exaplained things better.

I want to be able to select the record to be emailed, and when I hit the
email button, I want a pop up box to appear contianing a combo with a list
of
the questions that are relevant to the record. How would I go about doing
that?



Arvin Meyer said:
Your code will work as written. If one of the controls is a combobox, the
bound column will be the one that's concatenated. However, if you want a
different column from the combo, just tell your code that, using a zero
(0)
based column count:

MyMessage = "Where Would I find the answer?" & vbCrLf & vbCrLf &
Me.[Field1].Column(1) & " " & Me.[Field2] & " " & Me.[Field3]

Column(1) would be the second column in the combo box, and likely the one
that's displayed.

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


efandango said:
I want to send emails that include some fields and additonally ask a
relevant
question relating to the fields.

I can automatically include the fields in the email body message; but I
also
want to select the relevant question from a pre-defined combo list?.

I suspect that because of the limit on parameters for the SendObject
command, I may have to combine the selected question with the output of
the
fields. I don't mind if this is the case, but need some help on how to
do
the
question selection routine and how to merge the question into the
'MyMessage'
String.

This is the code I have that will send a 'fixed message' to an email
recipient.

Private Sub btn_Email_Point_Request_Click()
Dim SendTo As String, MySubject As String, MyMessage As String
SendTo = "(e-mail address removed)"
MySubject = "Information Required"
MyMessage = "Where Would I find the answer?" & vbCrLf & vbCrLf &
Me.[Field1]
& " " & Me.[Field2] & " " & Me.[Field3]
DoCmd.SendObject acSendNoObject, , , SendTo, , , MySubject, MyMessage,
True
 
E

efandango

i understand hot wo esetup a rowsource for a combo, etc.

I meant how would i go about getting the combo to pop-up?. I guess i would
need an extra form to hold the combo.

1. Select record to send by just clicking on it, from a continuous form.
2. Press email buton to send that record.
3. pop-up form asking me to select a question (cannot be on same form as
records; no room...).
4. send email

The problem I have is understanding where the data gets merged, and what
code to do it with. the record (and its fields)




Arvin Meyer said:
Your combo can have a list of questions, but you only get to pick 1 of them.

Create a table with an ID field and the question field. Use that table as
the rowsource for a combo box on the popup form.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

efandango said:
Arvin,

Having thought about your reply, it got me thinking about how i should
have
exaplained things better.

I want to be able to select the record to be emailed, and when I hit the
email button, I want a pop up box to appear contianing a combo with a list
of
the questions that are relevant to the record. How would I go about doing
that?



Arvin Meyer said:
Your code will work as written. If one of the controls is a combobox, the
bound column will be the one that's concatenated. However, if you want a
different column from the combo, just tell your code that, using a zero
(0)
based column count:

MyMessage = "Where Would I find the answer?" & vbCrLf & vbCrLf &
Me.[Field1].Column(1) & " " & Me.[Field2] & " " & Me.[Field3]

Column(1) would be the second column in the combo box, and likely the one
that's displayed.

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


I want to send emails that include some fields and additonally ask a
relevant
question relating to the fields.

I can automatically include the fields in the email body message; but I
also
want to select the relevant question from a pre-defined combo list?.

I suspect that because of the limit on parameters for the SendObject
command, I may have to combine the selected question with the output of
the
fields. I don't mind if this is the case, but need some help on how to
do
the
question selection routine and how to merge the question into the
'MyMessage'
String.

This is the code I have that will send a 'fixed message' to an email
recipient.

Private Sub btn_Email_Point_Request_Click()
Dim SendTo As String, MySubject As String, MyMessage As String
SendTo = "(e-mail address removed)"
MySubject = "Information Required"
MyMessage = "Where Would I find the answer?" & vbCrLf & vbCrLf &
Me.[Field1]
& " " & Me.[Field2] & " " & Me.[Field3]
DoCmd.SendObject acSendNoObject, , , SendTo, , , MySubject, MyMessage,
True
 
A

Arvin Meyer [MVP]

efandango said:
i understand hot wo esetup a rowsource for a combo, etc.

I meant how would i go about getting the combo to pop-up?. I guess i would
need an extra form to hold the combo.

1. Select record to send by just clicking on it, from a continuous form.

Use a double-click event to open a popup form.
3. pop-up form asking me to select a question (cannot be on same form as
records; no room...).

Read the record from the continuous form (it should still be selected)

Add a button to run the email code
4. send email

The email form can also be the popup, just put the combo on it. Reading the
data can be accomplished by looking at the continuous form. Just set the
default values of the unbound textboxes on the popup to read the values from
the continuous form:

=Forms!ContinuousFormName!TextboxName
 
E

efandango

Arvin,

Thanks for your help and advice; I now have a fully functioning email form
with an optional questions combo. (and I've learned a little more along the
way...)

regards

Eric
 

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

Similar Threads

SendObject Email 2
Emailing information about a specific record 4
acFormatHTML question 0
Email issue 0
Send Records from Form, Method or Data Error not Found" 0
Email Issue 1
Email fro FORM 4
Email problem 5

Top