[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Access does not overwrite existing Excel file after 2 times

Posted on 2012-08-28
7
Medium Priority
?
773 Views
Last Modified: 2012-08-28
I have an Access form where a user chooses from a drop down list the person they want to send the info to.

Access exports a query to an Excel file.  It needs to overwrite this file each time for a new person.

It works fine for the first 2 people.  When I go to the 3rd or 4th person, it stops overwriting the Excel file.

In the attached file, it's form frmVacyQuestMgrsORIG

Please let me know what I'm doing wrong.

Thanks!
VacyQuest-Data-for-Mgrs---Copy.accdb
0
Comment
Question by:Patty01Access
  • 3
  • 2
  • 2
7 Comments
 
LVL 28

Expert Comment

by:omgang
ID: 38342181
How bizarre, how bizarre!  When I right-click on the query and choose export --> Excel and overwrite the Text.xlsx file it exhibits the same behavior, e.g. the file last modified time stamp changes but the data in the file does not nor does it match what it should.

OM Gang
0
 

Author Comment

by:Patty01Access
ID: 38342224
Yes, it's driving me crazy!

 Even when I do it manually (right click on the query-Export to Excel), I say to overwrite the existing file.  It says it does, but it does not.  I don't see a time stamp change after the 3rd one--still shows the time stamp for the 2nd one only.
0
 
LVL 28

Accepted Solution

by:
omgang earned 2000 total points
ID: 38342251
It's got something to do with the TransferSpreadsheet method.  I changed your procedure to use the OutputTo method and it works fine.  Only drawback is Excel file is xls not xlsx.

DoCmd.OutputTo acOutputQuery, "qryVacyQuestWord", acFormatXLS, "C:\Vacancy\Quest\Test.xls"

I tried creating a blank .mdb database and copying all your objects into it but the same problem manifests.

Haven't seen this before but I don't think I've tried repeatedly exporting the same query to Excel and overwriting the output file.

Weird.
OM Gang
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 28

Expert Comment

by:omgang
ID: 38342260
I saw the time stamp change each time I performed the export.  The content didn't change so I'm thinking the process exported the same data some how.
OM Gang
0
 

Author Closing Comment

by:Patty01Access
ID: 38342290
That's it!  Changing it from "transferspreadsheet" to the outputto worked perfectly!!

Thanks much OM Gang!!
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38342319
Do you have "write" privileges to the target location??

Is it always after the "second" file, or is this always after a "specific" file"?

Have you tried OutputTo instead:
        DoCmd.OutputTo acOutputQuery, "qryVacyQuestWord", acFormatXLS, "C:\Vacancy\Quest\Merge\Word\" & xlFile

As a quick and dirty test:
Create a new DB and import all the objects and try this code in the new db.

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38342322
opps, I see this has already been resolved...
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

872 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