Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

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
0
JPDuval
Asked:
JPDuval
  • 3
  • 3
2 Solutions
 
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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