Advertisement

04.14.2008 at 11:23PM PDT, ID: 23322765
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

Problem in formatting when exporting Report to Excel from Access

Asked by ckangas7 in Access Reports, Access Coding/Macros, VB Script

Tags: ,

I have a query (see below) in Access that creates a report.  The report needs to be sent as an excel email attachment and sometimes just needs to be saves as an excel file.  The VB commands I am using to do this are:

To export to excel I use:
DoCmd.OutputTo acOutputReport, "Stores Report Export", acFormatXLS, "C:\Central Billing\Export\store.xls"

To send report as email I use:
DoCmd.SendObject acSendReport, "Stores Report Export", acFormatXLS, _
    "john@john.com", "c.w@gmail.com", , _
    "Store Reports", "Here are your reports.", True

Problem is that in the generated excel file/attachment the leading zero on the Distributor ID column is stripped and the WeekInv is comming out as some strange number no here near what it should be and he "-" character is being stripped as well.

Iv'e tried Cstr in sql to make sure the fiield is read as text.  Have also tried formatting it as text in the report.  How do I tell excell that I want these columns as literal text and not numbers?


Start Free Trial
1:
2:
3:
SELECT t_psd_imports.store_id AS [Store ID],  Cstr("0" & t_psd_imports.distributor_id) AS [Distributor ID], DatePart('yyyy',t_psd_imports.date) & "-" & DatePart('ww',t_psd_imports.date) AS [WeekInv], t_psd_imports.date AS [Invoice Date], t_stores.Deposit AS Deposit
FROM t_stores INNER JOIN (t_distributors INNER JOIN t_psd_imports ON t_distributors.distributor_id=t_psd_imports.distributor_id) ON t_stores.store_id=t_psd_imports.store_id
WHERE (((t_psd_imports.record_type)='DC')) And t_psd_imports.store_id=Forms![Store Report Dialog]!SelectStore
[+][-]04.15.2008 at 12:04AM PDT, ID: 21356511

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Reports, Access Coding/Macros, VB Script
Tags: Access 2003, 2003
Sign Up Now!
Solution Provided By: harfang
Participating Experts: 2
Solution Grade: A
 
 
[+][-]04.15.2008 at 12:13AM PDT, ID: 21356559

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628