Email option on Form

eholtman

Registered User.
Local time
Today, 08:33
Joined
Oct 12, 2004
Messages
54
I have created a control tab on my form to email a report

Here is my code:


Private Sub Email_Click()
On Error GoTo Err_Email_Click

Dim stDocName As String

stDocName = "All Work Orders"
DoCmd.SendObject acSendForm, acReport, , E_Holtman, , , Work_Order, Here_is_a_Work_Order, , stDocName

Exit_Email_Click:
Exit Sub

Err_Email_Click:
MsgBox Err.Description
Resume Exit_Email_Click

End Sub


I am getting error The Form name '3' is misspelled..... I dont know where or why it looking for '3'. My report is called "All Work Orders"

What I am trying to do is Email Snapshot report to EHoltman with Subject Work Order and Message Here is a work Order.

Is there a better format to send reports like invoices than the snapshot. The only options that pop are Excel, Word, Rich text, HTML and Snapshot.

Thanks
 
I don't knwo what version you're using, but on my Access 2000, the object name is the second argument of the SendObject method, which means you are trying to use acReport as the name of the report, which of course it is not.

The reason it is looking for '3' is because three is the equivalent constant value of acReport, as per this: http://techrepublic.com.com/5100-6329_11-5107756.html

Hope this helps.

Nick
 
That help alot. One more question with this. Here is my thread

Private Sub Email_Click()
On Error GoTo Err_Email_Click

Dim stDocName As String

stDocName = "All Work Orders"

DoCmd.SendObject objecttype:=acSendReport, _
ObjectName:=stDocName, outputformat:=acFormatSNP, _
To:="XXXX@msn.com", Subject:="Company Work Order", MessageText:="Here is a XXX Work Order"

Exit_Email_Click:
Exit Sub

Err_Email_Click:
MsgBox Err.Description
Resume Exit_Email_Click

End Sub


What I want it do is add the ID number in the subject of the email.

DoCmd.SendObject objecttype:=acSendReport, _
ObjectName:=stDocName, outputformat:=acFormatSNP, _
To:="XXXX@msn.com", Subject:="Company Work Order" [ID], MessageText:="Here is a XXX Work Order"


So in the subject line it will say

Company Work Order [ID]
 

Users who are viewing this thread

Back
Top Bottom