By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,203 Members | 1,341 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,203 IT Pros & Developers. It's quick & easy.

send query in xls format by email --- sendobject

P: n/a
Hi, there,

I have a form with 2 email buttons both with docmd.sendobject code.
The 1st one send a report which is working properly. The 2nd one send
a query in xls format which is always get an error message say" ....
can't save the output data to the file you selected." I am very
confused. it used to work properly. And now, sometimes it works, most
time it doesn't work.

I am using ACC2000, outlook express and Win XP. below are the 2 email
buttons' code:
'------------------------------------
Private Sub cmdEmail_Click()
Dim strToWhom As String
Dim strMsgBody As String
Dim intSeeOutlook As Integer

intSeeOutlook = MsgBox("Preview e-mail message?", _
vbYesNo, "RFQ " & Me.Caption)

If intSeeOutlook = vbNo Then
strToWhom = InputBox("Enter recipient's e-mail address.", _
"EMAIL Address")
intSeeOutlook = False
End If

DoCmd.SendObject acSendReport, "RFQ", "snapshot format", _
strToWhom, , , "RFQ " & Me.Caption, _
"Here is our RFQ", intSeeOutlook

End Sub

'---------------------------------------

Private Sub email2_Click()
On Error GoTo Err_email_Click
DoCmd.SendObject acSendQuery, "Email_RFQ_table", acFormatXLS, _
"ho*@meus.mea.com", , , "QDI " & Me.Caption, _
"Here is our QDI Data", , False
Exit_email_Click:
Exit Sub

Err_email_Click:
MsgBox Err.Description
Resume Exit_email_Click
End Sub
'-------------------------------
the "Email_RFQ_table" query is :
SELECT Bid_RFQ.*
FROM Bid_RFQ
WHERE (((Bid_RFQ.ID)=[forms]![rfq]![rfqid]));

also, bid_rfq is a query. So the "Email_RFQ_table" query is based on
another query. The 2 buttons are on the form called "RFQ".

Thanks alot. pls help me..
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.