Transfer Text Export

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

I am using the code below. The files are exporting as comma
delimited. Is there a way for them to export as tab delimited?

For Each qdf In db.QueryDefs
strqryName = qdf.Name
If strqryName Like "exp_*" Then
SysCmd acSysCmdSetStatus, "Exporting " & strqryName &
"..."
DoCmd.TransferText acExportDelim, , strqryName, _
"C:\Documents and Settings\griffis1\My Documents\MASUNL\" _
& Mid(strqryName, 5) & ".txt", True
End If
Next qdf
Thanks for you assistance!!!
 
Use a Specification that you create, where you specify tab-delimited. Then
use that Specification in the TransferText action -- second argument:

DoCmd.TransferText acExportDelim, SPECIFICATIONNAME, strqryName,
_
"C:\Documents and Settings\griffis1\My Documents\MASUNL\" _
& Mid(strqryName, 5) & ".txt", True

You create a specification by starting to do the export manually (File |
Export) and following the steps until you get to the Wizard screen; then
click on Advanced button at bottom left to set the specs and save the
specification with a name of your choosing. After you've saved the
specification, you can cancel the export.
 
Use a Specification that you create, where you specify tab-delimited. Then
use that Specification in the TransferText action -- second argument:

           DoCmd.TransferText acExportDelim, SPECIFICATIONNAME, strqryName,
_
  "C:\Documents and Settings\griffis1\My Documents\MASUNL\" _
     & Mid(strqryName, 5) & ".txt", True

You create a specification by starting to do the export manually (File |
Export) and following the steps until you get to the Wizard screen; then
click on Advanced button at bottom left to set the specs and save the
specification with a name of your choosing. After you've saved the
specification, you can cancel the export.
--

        Ken Snell
<MS ACCESS MVP>http://www.accessmvp.com/KDSnell/







- Show quoted text -

Thank you for your help. I have another question about this. I have
multiple queries that are exporting, do I need a SPECIFICATIONNAME for
each file? If so is there a way to call all of them and point them to
the correct file. Or is there a way to create a SPECIFICATIONNAME to
cover all the queries?

Sam
 
A single Specification can be used for multiple files AS LONG AS all the
files have the same structure. You'll need a different specification for
each different structure of the file.
--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/



Use a Specification that you create, where you specify tab-delimited. Then
use that Specification in the TransferText action -- second argument:

DoCmd.TransferText acExportDelim, SPECIFICATIONNAME, strqryName,
_
"C:\Documents and Settings\griffis1\My Documents\MASUNL\" _
& Mid(strqryName, 5) & ".txt", True

You create a specification by starting to do the export manually (File |
Export) and following the steps until you get to the Wizard screen; then
click on Advanced button at bottom left to set the specs and save the
specification with a name of your choosing. After you've saved the
specification, you can cancel the export.
--

Ken Snell
<MS ACCESS MVP>http://www.accessmvp.com/KDSnell/







- Show quoted text -

Thank you for your help. I have another question about this. I have
multiple queries that are exporting, do I need a SPECIFICATIONNAME for
each file? If so is there a way to call all of them and point them to
the correct file. Or is there a way to create a SPECIFICATIONNAME to
cover all the queries?

Sam
 
A single Specification can be used for multiple files AS LONG AS all the
files have the same structure. You'll need a different specification for
each different structure of the file.
--

        Ken Snell
<MS ACCESS MVP>http://www.accessmvp.com/KDSnell/









Thank you for your help. I have another question about this.   I have
multiple queries that are exporting, do I need a SPECIFICATIONNAME for
each file?  If so is there a way to call all of them and point them to
the correct file.  Or is there a way to create a SPECIFICATIONNAME to
cover all the queries?

Sam- Hide quoted text -

- Show quoted text -

When you say structure, what do you mean? Same number of fields? I'm
not qutie sure and am still having issues with getting this to work.
 
By structure, I mean
-- same number of fields in all the text files
-- same datatype for a field in all the text files
-- same name for a field in all the text files
-- same data layout (comma-delimited, fixed-width, etc.) in all the text
files

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/



A single Specification can be used for multiple files AS LONG AS all the
files have the same structure. You'll need a different specification for
each different structure of the file.
--

Ken Snell
<MS ACCESS MVP>http://www.accessmvp.com/KDSnell/









Thank you for your help. I have another question about this. I have
multiple queries that are exporting, do I need a SPECIFICATIONNAME for
each file? If so is there a way to call all of them and point them to
the correct file. Or is there a way to create a SPECIFICATIONNAME to
cover all the queries?

Sam- Hide quoted text -

- Show quoted text -

When you say structure, what do you mean? Same number of fields? I'm
not qutie sure and am still having issues with getting this to work.
 
Back
Top