MS Access DoCmd.TransferText acExportDelim But For Creating New Files Not Existing Files.

I am familiar with using DoCmd.TransferText acExportDelim for exporting and writing over a EXISTING CSV file in a folder but what would I use to write a new file if it was not there?  

If Dir("C:\DailyExport\NewExport.CSV") <> "" Then
DoCmd.TransferText acExportDelim, "ExportToComExportSpecification2", "ComExportNewTemp", "C:\DailyExport\NewExport.CSV", True
    ' put code here to elicit a new file name or you can add a number on to the name
End If

Open in new window

Thanks for the help.
Dustin StanleyEntrepreneurAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

what happens if you use same code as if exists? perhaps it will create the file for you..

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gustav BrockCIOCommented:
what would I use to write a new file if it was not there?

Nothing else. The file will simply be created.
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Usually with most operations you have the opposite problem; if the file is already there, you have a problem because the operation fails or you get a warning.  The way around that is to delete  (VBA Kill) the file first if it exists.

 So like the others, not sure I understand what the issue is.

Dale FyeOwner, Developing Solutions LLCCommented:
Are you asking how to open the file dialog to allow you to browse you computer, select a folder, and assign a file name, as you would when saving a Word, Excel, or Access database?  If so, you will need a reference to the Microsoft Office ##.0 Object Library, and then code similar to that seen in this article.
Dustin StanleyEntrepreneurAuthor Commented:
It didn't seem right to me either but there must had been some underlying issue that worked out. It was giving me an error but now it just creates it fine. Boggling but it works now. Thanks for the help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.