Yup, you can...takes a bit of work...
In a module, select Tools, references, and add a reference to Outlook.
Create the query, possible using run-time options.
Programatically output the query as a text file to an outside text file, naming the text file .csv.
(NB if the query includes memo fields, you will have to use a append query to make a table of the query, and then output the table)
Create a public function something like this....
Function SendOutlookMessage(Recipients As String, Subject As String, Body As String, DisplayMsg As Boolean, Optional CopyRecipients As String, Optional BlindCopyRecipients As String, Optional Importance As Integer = 2, Optional AttachmentPath)
'Function to create and send an outlook message with more control than sendobject
'separate multiple recipients or CC, or BCC with comma
'importance - 1=low, 2=normal, 3=high
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.recipient
Dim objOutlookAttach As Outlook.Attachment
Dim txtRecipient As String
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application"
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Do While InStr(1, Recipients, ",", vbTextCompare) <> 0 'checks for multiple recipients and adds each
txtRecipient = Left(Recipients, InStr(1, Recipients, ",", vbTextCompare) - 1)
Recipients = Trim(Mid(Recipients, Len(txtRecipient) + 2, Len(Recipients)))
Set objOutlookRecip = .Recipients.Add(txtRecipient)
objOutlookRecip.Type = olTo
Loop
Set objOutlookRecip = .Recipients.Add(Trim(Recipients))
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message if existing
If CopyRecipients <> "" Then
Set objOutlookRecip = .Recipients.Add(CopyRecipients)
objOutlookRecip.Type = olCC
End If
' Add the BCC recipient(s) to the message.
If BlindCopyRecipients <> "" Then
Set objOutlookRecip = .Recipients.Add(BlindCopyRecipients)
objOutlookRecip.Type = olBCC
End If
' Set the Subject, Body, and Importance of the message.
.Subject = Subject
.Body = Body & vbCrLf & vbCrLf
Select Case Importance
Case 1
.Importance = olImportanceLow
Case 2
.Importance = olImportanceNormal
Case 3
.Importance = olImportanceHigh
Case Else
.Importance = olImportanceNormal
End Select
' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
' Should we display the message before sending?
If DisplayMsg Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing
End Function
Call this function from your code, using the final option attachmentpath, to include your file.....
Am email will be created - you have the option of editing it or not before it is sent.
HTH