Exporting Query into tab delimited text format

Hello, Please help I have to export a select query as a tab delimited text file to a specific folder from a control button on click().  Once it reaches the folder i need any other files in that folder to be deleted and the new one replace them with the same name.  Is this possible, please walk me through it, I am new.  Thank you in advance
JPDuvalAsked:
Who is Participating?
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.

GRayLCommented:
Assuming the files in the folder have the same name with different extensions what extension do you want to assign the replacement?
0
dmitryz6Commented:
first craete specification

On click

kill ","C:\test\*"
docmd.transfertext acexportdelim,"SpecificationName","qryANme","C:\test\test.txt"
0
dmitryz6Commented:
How to craete specification

Find query in database window->File->Export->Save as type-> text file->Export _> advance ->create specification _>save it


On click

kill "C:\test\*"
docmd.transfertext acexportdelim,"SpecificationName","qryANme","C:\test\test.txt"
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

GRayLCommented:
Make sure when you are creating the specification that you specify - tab delimited.  Otherwise it will default to comma delimited.
0
JPDuvalAuthor Commented:
Let's make this simpler.  My query name is "qrySelectOrders",  My Destination folder is "Import" on my C drive.  Please walk me through it.
0
GRayLCommented:
In the click event of the command button XferFile you have put in this code:

Private Sub cmdXferFile_Click()

  Dim filename as String       'dimension the variable filename
  filename=c:\Import\*.*     'capture the file name of the file in that location.  assumes one only
  kill "C:\Import\*.*"            'deletes that file
  docmd.transfertext acExportDelim, "SpecName","qryName","C:\Import\" & fileName  

' substitute your queryname for "qryName" and your specification name for "SpecName" in this string.  This command will create the delimited file from your query located at "C:\Import\ with whatever filename was in the folder.

End Sub
0

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
dmitryz6Commented:
kill "C:\import\*"
docmd.transfertext acexportdelim,"SpecificationName","qrySelectOrders","C:\import\SelectOrders.txt"
0
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.

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.