help with form command

  • Thread starter Thread starter rejoyce40
  • Start date Start date
R

rejoyce40

I've learned a lot through this help forum, but only enough to be dangerous!

I would like to have a form displaying names that I can select [multiple
select] and then have a command button that would open the email program with
the email addresses of the selected names in the To: line. I can then write
the message in the body of the email.

I don't need to attach anything, via the form, to the email - just want to
be able to select multiple email recipients.

I've tried modifying the Email2Senate form, but my limited knowledge didn't
get me anywhere but frustrated.

Your help would be much appreciated, and thanks in advance!
 
What you need is a multi select list box with a list of all the email
addresses. You probably want a two column query for your list box that has
the person's name to make it easy for the user to select. Make the email
address the firsl column and the name the second column. You can hide the
email address from the user by setting the column widths property of the list
box to something like 0";3"
The 0" will make the email address hidden. The 3" you can adjust to show
the name properly. Then in the click event of the button where you send the
email addresses you will want to create a string to use in the To argument of
your SendObject. Here is how you would do that:

Dim strTo As String

With Me.MyList Box
For Each varItem In .ItemsSelected
strTo = strTo & .ItemData(varItem) & "; "
Next varItem
End With

At this point, strTo will be a string of the email addresses separated with
a ;
 
Thank you so much for the quick response.

I had no problem understanding the list box instructions, but could you
please provide the step-by-step detail for the remainder of your instructions
for the command button? I'm sorry for my ignorance - I tried to figure it
out, but I just couldn't!!

Thanks again!!

Klatuu said:
What you need is a multi select list box with a list of all the email
addresses. You probably want a two column query for your list box that has
the person's name to make it easy for the user to select. Make the email
address the firsl column and the name the second column. You can hide the
email address from the user by setting the column widths property of the list
box to something like 0";3"
The 0" will make the email address hidden. The 3" you can adjust to show
the name properly. Then in the click event of the button where you send the
email addresses you will want to create a string to use in the To argument of
your SendObject. Here is how you would do that:

Dim strTo As String

With Me.MyList Box
For Each varItem In .ItemsSelected
strTo = strTo & .ItemData(varItem) & "; "
Next varItem
End With

At this point, strTo will be a string of the email addresses separated with
a ;
--
Dave Hargis, Microsoft Access MVP


rejoyce40 said:
I've learned a lot through this help forum, but only enough to be dangerous!

I would like to have a form displaying names that I can select [multiple
select] and then have a command button that would open the email program with
the email addresses of the selected names in the To: line. I can then write
the message in the body of the email.

I don't need to attach anything, via the form, to the email - just want to
be able to select multiple email recipients.

I've tried modifying the Email2Senate form, but my limited knowledge didn't
get me anywhere but frustrated.

Your help would be much appreciated, and thanks in advance!
 
Do you have currently have code you use to send the e-mails?
If so, please post it; otherwise, what is it you need to know?
--
Dave Hargis, Microsoft Access MVP


rejoyce40 said:
Thank you so much for the quick response.

I had no problem understanding the list box instructions, but could you
please provide the step-by-step detail for the remainder of your instructions
for the command button? I'm sorry for my ignorance - I tried to figure it
out, but I just couldn't!!

Thanks again!!

Klatuu said:
What you need is a multi select list box with a list of all the email
addresses. You probably want a two column query for your list box that has
the person's name to make it easy for the user to select. Make the email
address the firsl column and the name the second column. You can hide the
email address from the user by setting the column widths property of the list
box to something like 0";3"
The 0" will make the email address hidden. The 3" you can adjust to show
the name properly. Then in the click event of the button where you send the
email addresses you will want to create a string to use in the To argument of
your SendObject. Here is how you would do that:

Dim strTo As String

With Me.MyList Box
For Each varItem In .ItemsSelected
strTo = strTo & .ItemData(varItem) & "; "
Next varItem
End With

At this point, strTo will be a string of the email addresses separated with
a ;
--
Dave Hargis, Microsoft Access MVP


rejoyce40 said:
I've learned a lot through this help forum, but only enough to be dangerous!

I would like to have a form displaying names that I can select [multiple
select] and then have a command button that would open the email program with
the email addresses of the selected names in the To: line. I can then write
the message in the body of the email.

I don't need to attach anything, via the form, to the email - just want to
be able to select multiple email recipients.

I've tried modifying the Email2Senate form, but my limited knowledge didn't
get me anywhere but frustrated.

Your help would be much appreciated, and thanks in advance!
 
No code.

Do I use the Command Button Wizard or do I use the properties/On Click for
the command button? This is where I get confused and I wasn't sure what to
do with the latter part of your instructions.

Thanks again for your help and your patience.

Klatuu said:
Do you have currently have code you use to send the e-mails?
If so, please post it; otherwise, what is it you need to know?
--
Dave Hargis, Microsoft Access MVP


rejoyce40 said:
Thank you so much for the quick response.

I had no problem understanding the list box instructions, but could you
please provide the step-by-step detail for the remainder of your instructions
for the command button? I'm sorry for my ignorance - I tried to figure it
out, but I just couldn't!!

Thanks again!!

Klatuu said:
What you need is a multi select list box with a list of all the email
addresses. You probably want a two column query for your list box that has
the person's name to make it easy for the user to select. Make the email
address the firsl column and the name the second column. You can hide the
email address from the user by setting the column widths property of the list
box to something like 0";3"
The 0" will make the email address hidden. The 3" you can adjust to show
the name properly. Then in the click event of the button where you send the
email addresses you will want to create a string to use in the To argument of
your SendObject. Here is how you would do that:

Dim strTo As String

With Me.MyList Box
For Each varItem In .ItemsSelected
strTo = strTo & .ItemData(varItem) & "; "
Next varItem
End With

At this point, strTo will be a string of the email addresses separated with
a ;
--
Dave Hargis, Microsoft Access MVP


:

I've learned a lot through this help forum, but only enough to be dangerous!

I would like to have a form displaying names that I can select [multiple
select] and then have a command button that would open the email program with
the email addresses of the selected names in the To: line. I can then write
the message in the body of the email.

I don't need to attach anything, via the form, to the email - just want to
be able to select multiple email recipients.

I've tried modifying the Email2Senate form, but my limited knowledge didn't
get me anywhere but frustrated.

Your help would be much appreciated, and thanks in advance!
 
You would want to use the Click event of a command button to send the email.
The code I provided only creates a formatted list of receipients to use in
the To argument of the Sendobject method.
--
Dave Hargis, Microsoft Access MVP


rejoyce40 said:
No code.

Do I use the Command Button Wizard or do I use the properties/On Click for
the command button? This is where I get confused and I wasn't sure what to
do with the latter part of your instructions.

Thanks again for your help and your patience.

Klatuu said:
Do you have currently have code you use to send the e-mails?
If so, please post it; otherwise, what is it you need to know?
--
Dave Hargis, Microsoft Access MVP


rejoyce40 said:
Thank you so much for the quick response.

I had no problem understanding the list box instructions, but could you
please provide the step-by-step detail for the remainder of your instructions
for the command button? I'm sorry for my ignorance - I tried to figure it
out, but I just couldn't!!

Thanks again!!

:

What you need is a multi select list box with a list of all the email
addresses. You probably want a two column query for your list box that has
the person's name to make it easy for the user to select. Make the email
address the firsl column and the name the second column. You can hide the
email address from the user by setting the column widths property of the list
box to something like 0";3"
The 0" will make the email address hidden. The 3" you can adjust to show
the name properly. Then in the click event of the button where you send the
email addresses you will want to create a string to use in the To argument of
your SendObject. Here is how you would do that:

Dim strTo As String

With Me.MyList Box
For Each varItem In .ItemsSelected
strTo = strTo & .ItemData(varItem) & "; "
Next varItem
End With

At this point, strTo will be a string of the email addresses separated with
a ;
--
Dave Hargis, Microsoft Access MVP


:

I've learned a lot through this help forum, but only enough to be dangerous!

I would like to have a form displaying names that I can select [multiple
select] and then have a command button that would open the email program with
the email addresses of the selected names in the To: line. I can then write
the message in the body of the email.

I don't need to attach anything, via the form, to the email - just want to
be able to select multiple email recipients.

I've tried modifying the Email2Senate form, but my limited knowledge didn't
get me anywhere but frustrated.

Your help would be much appreciated, and thanks in advance!
 
Back
Top