Solved

MS Access 2010 - ExportwithFormatting Action

Posted on 2011-02-25
5
3,614 Views
Last Modified: 2012-05-11
Hi All,

Looking for what I have wrong here. I am have built a macro to export data from a table, then run a delete query to remove the records. I need to save the export by date (this routine will run nightly) The Output File is set to
"z:\Data_" & Format(Date(),("dd-mm-yyyy") & ".xlsx"

However I am receiving the follwoing error:

"Microsft Access can't save the ouput data to the file you've selected." (error: 2302)

Can anyone tell me what I have wrong?

Thanks,

Steve
0
Comment
Question by:SDBrooks
  • 3
  • 2
5 Comments
 
LVL 84
Comment Utility
Try this instead:

"z:\Data_" & Day(Date) & "_" & Month(Date) & "_" & Year(Date) & ".xlsx"

0
 

Author Comment

by:SDBrooks
Comment Utility
Interesting, but didn't work either. Any other suggestions?
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 125 total points
Comment Utility
Could simply mean that you cannot save data to that location. Try first saving it to this:

"z:\TestDataFile.xls"

If that works, add the Date to it:

"z:\TestDataFile" & CStr(Date()) & ".xls"

And so on, until you hit a snag.

0
 

Author Comment

by:SDBrooks
Comment Utility
I can write to the folder with no problem if I don't try and add the date function.

This didnt work either.  It's always the simple things that become difficult to do. Thanks for trying.

Any other suggestions?
0
 
LVL 84
Comment Utility
Are you actually doing this in a Macro? If so, perhaps changing over to VBA Code is a better solution. You have MUCH more control using that. Note you can "convert" your macro to VBA using the builtin utility.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now