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

how to disable output format option in sendobject command

P: 62
i am mailing report in which all details are specified in body of mail, so do not require any attachment to go with that mail.
So my question is how to disable or what to write in code to disable output format which is asked in
Expand|Select|Wrap|Line Numbers
  1. DoCmd.SendObject
  2.  
Dec 23 '13 #1

✓ answered by zmbd

First you need to understand the command you are using so: DoCmd.SendObject Method (Access) Office 2010

It's importaint to understand what you are doing; however, if you just want a "fish" then goto the bottom of this post.

However, IMHO, it's better to learn how to fish (^_^):

Let's break down what you have:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.SendObject _
  2.    ObjectType:=acSendReport, _
  3.    ObjectName:="ConfirmationDateReminderReport", _
  4.    OutputFormat:="Excel97-Excel2003Workbook(*.xls)", _
  5.    To:=Me.Reporting_Authority_Email, _
  6.    Cc:=Me.[HR_Representative_Name_Email], _
  7.    Bcc:="", _
  8.    Subject:="CONFIRMATION REMINDER", _
  9.    MessageText:="This is to inform you that " & Me.[Emp_Full_Name] & " is Due for confirmation on " & Me.Confirmation_Date & ".", _
  10.    EditMessage:=True, _
  11.    TemplateFile:=""
Note that I am using the named Parameters ("ObjectType"), these are set using the ":=" symbols, and I've placed these on their own lines using the "_" continuation charactor. Using the named parameters in this case will make things easier to follow, fix, and modify.

Errors as you have:
- Your OutputFormat entry is invalid it needs to be one of the following (why they make this so difficult to find I don't know - but it is!):
acFormatHTML: HTML format
acFormatRTF: Rich text format (RTF)
acFormatSNP: Access report snapshot
acFormatTXT: Plain text
acFormatXLS: Excel 2000-2003
acFormatXLSB: Excel Binary Workbook (*.xlsb)
acFormatXLSX: Excel Workbook (*.xlsx) Excel 2007/10
acFormatXPS: XPS Format (*.xps) * XPS format
acFormatPDF: PDF Format (*.pdf) * PDF report
(note that snapshot may not available after ACC2010 and pdf is only available for 2007 w/service pack and for 2010 and newer) YOU MUST READ THE LINK TO THIS METHOD as there some limitations as to what and how things are transfered. ONLY the Snap, XPS, and PDF formats will preserve a report format as shown on the screen, also, memo fields are truncated at 255 charactors.

- Second error was in your "MessaageText" it is fixed above; you have: & " .True, ""
you need: & ".", True, ""
Personally, I would have built the string for the MessageText first and then placed the string in the function. As you have it now, if there are any errors, such as this, in either in the string or the function it will be difficult to fix/spot (this is petpeeve of mine that MS and others show to build the string within the function - PC's are fast, have tons of memory, and one line of code isn't going to slow the processor by so much as a 1/1000000 of a jiffy).

Now that we have that cleared up, what I am reading is that you want to send an email only, no object?

In that case, using the corrected code and my suggestion to build the message text string first:
Expand|Select|Wrap|Line Numbers
  1. '(...)
  2. Dim strMessage As String
  3. '(...)
  4. strMessage = "This is to inform you that " & _
  5.    Me.[Emp_Full_Name] & _
  6.    " is Due for confirmation on " & _
  7.    Me.Confirmation_Date & "."
  8. '
  9. DoCmd.SendObject _
  10.    ObjectType:=acSendNoObject, _
  11.    To:=Me.Reporting_Authority_Email, _
  12.    Cc:=Me.[HR_Representative_Name_Email], _
  13.    Subject:="CONFIRMATION REMINDER", _
  14.    MessageText:=strMessage, _
  15.    EditMessage:=True
  16.  
Notice by using the named parameters, I don't have to have all those extra commas nor include anything that we're not using that is also optional! (^_^)
This will Send out only the email message, no attachments.
You will want to have an error trap here because if the user cancels the email, the email client will return an error and stall your script at that point.

Just a suggestion for your posts:
I understand that it is a fineline between too much and too little; however, posting your actual problem code to start with is usually the best practice along with at least the a description of what you want, what is happening, and what you've tried.

(now I'm sure I've cross posted with someone; however, it takes time for me to re-read and spell check (^_^))

Share this Question
Share on Google+
5 Replies


zmbd
Expert Mod 5K+
P: 5,397
rahul2310:
You will need to post the entire code you are using to send the email. It sounds as if you are attempting to use two different methods to send the email.

Please format the vba script by selecting it and then clicking on the [CODE/] formating button.
Dec 23 '13 #2

P: 62
i am using simple code
Expand|Select|Wrap|Line Numbers
  1. DoCmd.SendObject acSendReport, "ConfirmationDateReminderReport", "Excel97-Excel2003Workbook(*.xls)", Me.Reporting_Authority_Email, Me.[HR_Representative_Name_Email], "", "CONFIRMATION REMINDER", "This is to inform you that " & Me.[Emp_Full_Name] & " is Due for confirmation on " & Me.Confirmation_Date & " .True, ""
I do not requires output format which is excel in this case.
If i leave it blank on button click it asks me for output format which i do not want
thanks
Dec 24 '13 #3

zmbd
Expert Mod 5K+
P: 5,397
First you need to understand the command you are using so: DoCmd.SendObject Method (Access) Office 2010

It's importaint to understand what you are doing; however, if you just want a "fish" then goto the bottom of this post.

However, IMHO, it's better to learn how to fish (^_^):

Let's break down what you have:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.SendObject _
  2.    ObjectType:=acSendReport, _
  3.    ObjectName:="ConfirmationDateReminderReport", _
  4.    OutputFormat:="Excel97-Excel2003Workbook(*.xls)", _
  5.    To:=Me.Reporting_Authority_Email, _
  6.    Cc:=Me.[HR_Representative_Name_Email], _
  7.    Bcc:="", _
  8.    Subject:="CONFIRMATION REMINDER", _
  9.    MessageText:="This is to inform you that " & Me.[Emp_Full_Name] & " is Due for confirmation on " & Me.Confirmation_Date & ".", _
  10.    EditMessage:=True, _
  11.    TemplateFile:=""
Note that I am using the named Parameters ("ObjectType"), these are set using the ":=" symbols, and I've placed these on their own lines using the "_" continuation charactor. Using the named parameters in this case will make things easier to follow, fix, and modify.

Errors as you have:
- Your OutputFormat entry is invalid it needs to be one of the following (why they make this so difficult to find I don't know - but it is!):
acFormatHTML: HTML format
acFormatRTF: Rich text format (RTF)
acFormatSNP: Access report snapshot
acFormatTXT: Plain text
acFormatXLS: Excel 2000-2003
acFormatXLSB: Excel Binary Workbook (*.xlsb)
acFormatXLSX: Excel Workbook (*.xlsx) Excel 2007/10
acFormatXPS: XPS Format (*.xps) * XPS format
acFormatPDF: PDF Format (*.pdf) * PDF report
(note that snapshot may not available after ACC2010 and pdf is only available for 2007 w/service pack and for 2010 and newer) YOU MUST READ THE LINK TO THIS METHOD as there some limitations as to what and how things are transfered. ONLY the Snap, XPS, and PDF formats will preserve a report format as shown on the screen, also, memo fields are truncated at 255 charactors.

- Second error was in your "MessaageText" it is fixed above; you have: & " .True, ""
you need: & ".", True, ""
Personally, I would have built the string for the MessageText first and then placed the string in the function. As you have it now, if there are any errors, such as this, in either in the string or the function it will be difficult to fix/spot (this is petpeeve of mine that MS and others show to build the string within the function - PC's are fast, have tons of memory, and one line of code isn't going to slow the processor by so much as a 1/1000000 of a jiffy).

Now that we have that cleared up, what I am reading is that you want to send an email only, no object?

In that case, using the corrected code and my suggestion to build the message text string first:
Expand|Select|Wrap|Line Numbers
  1. '(...)
  2. Dim strMessage As String
  3. '(...)
  4. strMessage = "This is to inform you that " & _
  5.    Me.[Emp_Full_Name] & _
  6.    " is Due for confirmation on " & _
  7.    Me.Confirmation_Date & "."
  8. '
  9. DoCmd.SendObject _
  10.    ObjectType:=acSendNoObject, _
  11.    To:=Me.Reporting_Authority_Email, _
  12.    Cc:=Me.[HR_Representative_Name_Email], _
  13.    Subject:="CONFIRMATION REMINDER", _
  14.    MessageText:=strMessage, _
  15.    EditMessage:=True
  16.  
Notice by using the named parameters, I don't have to have all those extra commas nor include anything that we're not using that is also optional! (^_^)
This will Send out only the email message, no attachments.
You will want to have an error trap here because if the user cancels the email, the email client will return an error and stall your script at that point.

Just a suggestion for your posts:
I understand that it is a fineline between too much and too little; however, posting your actual problem code to start with is usually the best practice along with at least the a description of what you want, what is happening, and what you've tried.

(now I'm sure I've cross posted with someone; however, it takes time for me to re-read and spell check (^_^))
Dec 24 '13 #4

P: 62
BEST it works like a champ
thanks a lot zmbd
Dec 24 '13 #5

zmbd
Expert Mod 5K+
P: 5,397
You're very welcome and you can call me "Z" (^_^)
Dec 24 '13 #6

Post your reply

Sign in to post your reply or Sign up for a free account.