Solved

Query output to Excel producing error

Posted on 2016-11-17
7
64 Views
Last Modified: 2016-12-01
I have a query that when I run it producing the attached error.   I am not sure what it is saying, I am exporting the results of the query to a Excel Spreadsheet with the following:

Private Sub Command60_Click()

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "QryEbill", "C:\Documents\myexcel.xlsx", True
 
 FollowHyperlink "C:\Documents\myexcel.xlsx"

 End Sub
QueryError.PNG
0
Comment
Question by:seamus9909
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 34

Expert Comment

by:Norie
ID: 41891901
What type of query is QryEbill?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 41891905
try deleting the file first if it exists

Private Sub Command60_Click()

if dir("C:\Documents\myexcel.xlsx") <> "" then
     kill "C:\Documents\myexcel.xlsx"
end if


 DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "QryEbill", "C:\Documents\myexcel.xlsx", True
   
  FollowHyperlink "C:\Documents\myexcel.xlsx"

  End Sub
0
 

Author Comment

by:seamus9909
ID: 41891926
Having the existence of the file  myexcel.xlsx has no bearing on the error message.
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 1

Expert Comment

by:Peter Cole
ID: 41892103
I think the transfer determines the type of data in afield from the first few rows. Does QryEbill have the same type of data in all rows.  Are the first few rows numeric in one field then have Alpha characters later. Or date problems.
0
 

Author Comment

by:seamus9909
ID: 41892326
so the data looks ok. I compared the qry results in the designer to the excel spreadsheet and and the number of rows match I don't see anything wrong
0
 
LVL 1

Accepted Solution

by:
Peter Cole earned 500 total points
ID: 41892590
The error says contents of fields in 2 records were deleted.
Try exporting the query as a csv and the excel results as a csv and if not too long look for the differences. If a lot of rows long use something like winmerge.
0
 

Author Comment

by:seamus9909
ID: 41909502
I have a query that results in a field being created that if there are leading 0's will drop them from the results.  I would like the entire 9 digits to appear even when if there are 0's

Member #: Val(Left([Claim#],9))
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question