Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Query output to Excel producing error

Posted on 2016-11-17
7
Medium Priority
?
70 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

715 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