Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4321
  • Last Modified:

MS Access 2010 - ExportwithFormatting Action

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
SDBrooks
Asked:
SDBrooks
  • 3
  • 2
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Try this instead:

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

0
 
SDBrooksAuthor Commented:
Interesting, but didn't work either. Any other suggestions?
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
 
SDBrooksAuthor Commented:
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
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now