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

x
?
Solved

MS Access 2010 - ExportwithFormatting Action

Posted on 2011-02-25
5
Medium Priority
?
4,103 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
[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
  • 3
  • 2
5 Comments
 
LVL 85
ID: 34983094
Try this instead:

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

0
 

Author Comment

by:SDBrooks
ID: 34983268
Interesting, but didn't work either. Any other suggestions?
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 34983359
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
ID: 34984371
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 85
ID: 34986947
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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
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…

705 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