Use of SendObject method

M

Michael

I have a form with several check-boxes representing e-mail
recipients as follows:

-------------------------------
[v] (e-mail address removed)
[ ] (e-mail address removed)
[v] (e-mail address removed)
-------------------------------

I want to create a button which will send the results of a
certain query to the e-mail addresses which are checked in
the form. Is it possible? Please, give me a hint.
Thank you in advance.
 
R

Ronald Dodge

The "To" argument will contain the list of email address with a semicolon
separating each of the email addresses.

As far as how to setup the checkboxes, it's best to have each of the check
boxes along with their corresponding labels within a Frame Object. To do
that, first, create the frame on the form, then create each of your checkbox
objects within the frame. Once you do that, you could then use something
like the following code:

Dim strTo as String, ctrl as Control
For each ctrl in Frame.Controls
if ctrl.controltype = 106 then
if ctrl.value = -1 then
strTo = strTo & ";" & ctrl.caption
end if
strTo = VBA.Strings.Mid(strTo,2)
end if
Next

DoCmd.SendObject(<ObjectType>,<ObjectName>,<OutputFormat>,strTo,,,<Subject>)
 
R

Ronald Dodge

Correction on the sample code, the line that has the Mid function on it, it
needs to go below the "Next" line

Dim strTo as String, ctrl as Control
For each ctrl in Frame.Controls
if ctrl.controltype = 106 then
if ctrl.value = -1 then
strTo = strTo & ";" & ctrl.caption
end if
end if
Next

strTo = VBA.Strings.Mid(strTo,2)

DoCmd.SendObject(<ObjectType>,<ObjectName>,<OutputFormat>,strTo,,,<Subject>)



--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
Ronald Dodge said:
The "To" argument will contain the list of email address with a semicolon
separating each of the email addresses.

As far as how to setup the checkboxes, it's best to have each of the check
boxes along with their corresponding labels within a Frame Object. To do
that, first, create the frame on the form, then create each of your checkbox
objects within the frame. Once you do that, you could then use something
like the following code:

Dim strTo as String, ctrl as Control
For each ctrl in Frame.Controls
if ctrl.controltype = 106 then
if ctrl.value = -1 then
strTo = strTo & ";" & ctrl.caption
end if
strTo = VBA.Strings.Mid(strTo,2)
end if
Next
DoCmd.SendObject( said:
--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
Michael said:
I have a form with several check-boxes representing e-mail
recipients as follows:

-------------------------------
[v] (e-mail address removed)
[ ] (e-mail address removed)
[v] (e-mail address removed)
-------------------------------

I want to create a button which will send the results of a
certain query to the e-mail addresses which are checked in
the form. Is it possible? Please, give me a hint.
Thank you in advance.
 

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