E-Mail from access to contacts selec (1 Viewer)

LopeGF

New member
Local time
Today, 08:48
Joined
Dec 13, 2022
Messages
4
Hello To All:

  1. I have a query, that is controlled by a combo box.
  2. Depending on the value in the combo box, when I run my query, I get the info, filtered by value in the combo box.
  3. I also created a button that exports the query to Excel, and generates a dynamic file name based on different criteria (time, date & value in the combo box).
Now what I am looking to do is to send the file generated via outlook e-mail, the e-mail Address would be fed from a combo box.


Right now I have been working with the code bellow:

Private Sub Command127_Click()
On Error Resume Next
DoCmd.SendObject acSendQuery, "Query#1", acFormatXLSX, John.Doe@aol.com, , , [Forms]![A_frm_master_pro_id]![qte_proj_id_cmb] & "_" & [Forms]![A_frm_master_pro_id]![qte_ven_cmb], _, True
End Sub


As you can see the e-mail is currently fixed (this is for testing purposes) I will be later changing this, for it to choose an e-mail from the combo box.

My question is:
Is there a way to include code to mail the file generated via outlook e-mail directly from Access in the same process as in the one that is used to generate the dynamic file name?
 

Gasman

Enthusiastic Amateur
Local time
Today, 14:48
Joined
Sep 21, 2011
Messages
14,306
Yes. Use outlook automation and send as an attachment.
 

Users who are viewing this thread

Top Bottom