UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Docmd.outputto(objecttype) For Excel Sheet, Access 2003    
 
   
foxtrojan
post May 15 2017, 08:37 PM
Post#1



Posts: 1,069
Joined: 8-May 06
From: Singapore


I've this code which I want to Output to a Excel Spreadsheet.
CODE
DoCmd.OutputTo [color="#ff0000"]acOutputReport[/color], "SalesReportDailyTest.xls", acFormatXLS, strFilePath, False

but give me an error message that the Report doesn't exist. What is the correct (ObjectType)? Appreciate if anyone can help me.


Go to the top of the page
 
theDBguy
post May 15 2017, 09:53 PM
Post#2


Access Wiki and Forums Moderator
Posts: 70,408
Joined: 19-June 07
From: SunnySandyEggo


Hi,

I think the syntax is more like:

DoCmd.OutputTo acOutputReport, "ReportName", acFormatXLS, "SalesReportDailyTest.xls", False

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
foxtrojan
post May 16 2017, 10:16 AM
Post#3



Posts: 1,069
Joined: 8-May 06
From: Singapore


Hi DBguy, nice to hear from you. Will do as advised.
Go to the top of the page
 
theDBguy
post May 16 2017, 11:33 AM
Post#4


Access Wiki and Forums Moderator
Posts: 70,408
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Let us know how it goes... The Filename argument can also include the full path (drive and folder names).

Good luck!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
foxtrojan
post May 16 2017, 10:02 PM
Post#5



Posts: 1,069
Joined: 8-May 06
From: Singapore


Thanks DBguy, your code is okay, but I think my problem is that I am sending an Excel Spreadsheet, not a Report. That's why it could not find the filename.
Possible to send an Excel Spreadsheet instead of a Report from Access?
Go to the top of the page
 
theDBguy
post May 16 2017, 10:04 PM
Post#6


Access Wiki and Forums Moderator
Posts: 70,408
Joined: 19-June 07
From: SunnySandyEggo


Hi,

The OutputTo method is for "exporting" an Access object to an external file. You used the term "sending" and "send." Are you saying you want to "e-mail" a spreadsheet?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
foxtrojan
post May 17 2017, 10:34 PM
Post#7



Posts: 1,069
Joined: 8-May 06
From: Singapore


You are a real expert. Yes, I want to email a Daily Sales Report in Excel Format to pre-defined Recipients. I have a "Union All Query" that combines all the Sales figures from different branches and convert to an Excel spreadsheet, then email to the Recipients. I am doing it manually [very tedious] because of the problems:

[1] Un-able to convert to a pre-defined Excel template [read thru many postings but just do not have the knowledge how to make one work]
[2] Un-able to convert to an Email template [which you are helping me] so I need not do it manually in Outlook and
[3] Automate the whole process so I need not sit back every night doing it manually.

I read thru many postings that it can be done seamlessly but with my poor knowledge I am lost. Really appreciate if you can help me.

Thanking you







Go to the top of the page
 
theDBguy
post May 17 2017, 10:54 PM
Post#8


Access Wiki and Forums Moderator
Posts: 70,408
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Ignoring the problems you stated for the moment, try using the SendObject method instead of OutputTo.

OutputTo exports object but SendObject sends objects via email as attachments. Check the Help Topics for proper syntax but it goes somewhat like so:

DoCmd.SendObject acSendQuery, "UnionQueryName", acFormatXLS, "EmailAddressHere", , , "SubjectHere", "MessageBodyHere", True

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
foxtrojan
post May 19 2017, 02:00 AM
Post#9



Posts: 1,069
Joined: 8-May 06
From: Singapore


Thank you for your advice. Okay, one step at a time, I will re-do my codes according to yours. If encounter problems, will bet back to you.
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    22nd August 2017 - 03:28 PM