Using SendObject with a Combo Box choice

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Creating a form for a large DB. I understand how to attach a command to send
files by clicking a command button. However, I have 60 different types of
files that I need to send, and not enough room to include 60 command buttons.
I would like to use 1 command button and be able to pick from 60 diffent
files to send - possibly in tandem with a combo box. Is there a way to do
this? Or, should I just try and fit 60 command boxes on my form?
 
Brian said:
Creating a form for a large DB. I understand how to attach a command
to send files by clicking a command button. However, I have 60
different types of files that I need to send, and not enough room to
include 60 command buttons. I would like to use 1 command button and
be able to pick from 60 diffent files to send - possibly in tandem
with a combo box. Is there a way to do this? Or, should I just try
and fit 60 command boxes on my form?

Put whatever code you would put in a command button in the AfterUpdate event
of the ComboBox and you don't even need one command button. Just pull the
file name from the ComboBox instead of hard-coding it.
 
Still not getting it to work. From my interpretation of what you said, I have
a queried list of labs (files) in a combo box that I would like to send. From
the Combo Box, I select the lab (file) I would like to send information on.
After I select the appropriate lab name, I want an email to be sent
containing an Excel file that has information on that lab. What type of macro
do I write to get it to send the information? I really appreciate all the
help!

Thanks,

Brian
 
Brian said:
Still not getting it to work. From my interpretation of what you
said, I have a queried list of labs (files) in a combo box that I
would like to send. From the Combo Box, I select the lab (file) I
would like to send information on. After I select the appropriate lab
name, I want an email to be sent containing an Excel file that has
information on that lab. What type of macro do I write to get it to
send the information? I really appreciate all the help!

Your original post implied that you would know what code to write if you
were using a command button. Is that correct?

The terms "labs" and "files" mean nothing to me. I assumed that what you
need to send are reports. It now sounds like what you want to send are
queries. Is that correct?

Generically one would send a saved query object as an Excel file with...

DoCmd.SendObject acSendQuery, "QueryName", acFormatXLS, "Recipient",,,
"Subject", "Message", True

To grab the name of the query from the ComboBox would be...

DoCmd.SendObject acSendQuery, Me.ComboBoxName, acFormatXLS,
"Recipient",,,"Subject","Message",True
 
Back
Top