Use of SendObject method

  • Thread starter Thread starter Michael
  • Start date Start date
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.
 
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>)
 
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.
 
Back
Top