General discussion

Locked

Access - Exporting to Text File

By MK1 ·
I have an export program running which takes the contents of a table or query and writes them to a text file. However I do not wish to include the Table headings - Is there any easy way to do this ?

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Access - Exporting to Text File

by john_wills In reply to Access - Exporting to Tex ...

Private Sub ExportToText(SourceTable As String, PaymentKind As String, _
OutFileName As String, collapsed As Boolean)
Const sFn = "ExportToText"
Dim vStat As Variant
On Error GoTo ExportToText_Err
Me.cdlgExport.Flags= cdlOFNHideReadOnly
Me.cdlgExport.DefaultExt = ".txt"
Me.cdlgExport.Filter = "Text Files (*.txt)|*.txt"
Me.cdlgExport.FilterIndex = 1
Me.cdlgExport.InitDir = "U:\cc3 Transfer\AccessDatabases\"
Me.cdlgExport.FileName = ""
Me.cdlgExport.ShowSave
OutFileName = Me.cdlgExport.FileName

DoCmd.Hourglass True
DoCmd.TransferText acExportFixed, PaymentKind, SourceTable, OutFileName
DoCmd.Hourglass False
DoCmd.OpenForm "frmViewCTLFile", acNormal, , , , acDialog, OutFileName
ExportToText_Exit:
Exit Sub
ExportToText_Err:
ErrorMsg "Error in SubRoutine: '" & sFn & "', Module: '" & msDocName & "'", Err.Number, Err.Description
collapsed = True
Resume ExportToText_Exit
End Sub
cdlgExport is an ActiveX object of OLE class CommonDialog. To define the format of the output file, named in PaymentKind, You can use the Import or Link Tables subcommand of the Get External Data command or the Save As/Export command on the File menu to create a specification for a particular type of text file, such as a delimited text file that uses tabs to separate fields and has an MDY format for dates. When you click one of these commands and select a type of text file to import, export, or link, the Import Text Wizard, Export Text Wizard, or Link Text Wizard runs. You can click the Advanced button in the wizard and define and save a specification in the dialog box that appears. You can then type the specification name in this argument whenever you want to import or export the same type of text file.

Collapse -

Access - Exporting to Text File

by MK1 In reply to Access - Exporting to Tex ...

The question was auto-closed by TechRepublic

Collapse -

Access - Exporting to Text File

by Bristar In reply to Access - Exporting to Tex ...

Umm....Ahem...it's not nearly THAT complicated.
Just put a ", False" after your text file name.

Collapse -

Access - Exporting to Text File

by MK1 In reply to Access - Exporting to Tex ...

The question was auto-closed by TechRepublic

Collapse -

Access - Exporting to Text File

by Miss Kitty In reply to Access - Exporting to Tex ...

Or walk through the export and create a export specification for it and don't select include headings. Then set up a macro to export it for you and use the export specification. Works for me.
Cathy

Collapse -

Access - Exporting to Text File

by MK1 In reply to Access - Exporting to Tex ...

The question was auto-closed by TechRepublic

Collapse -

Access - Exporting to Text File

by MK1 In reply to Access - Exporting to Tex ...

This question was auto closed due to inactivity

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums