quote:You may want to scrub the output a bit also, replacing single quotes in your data steam with double quotes, that sort of thing.
Not exactly what I meant to say (was trying to write SQL and talk about table exporting at the same time).
What I meant to say is that, when you export a table via the user-interface commands using either a default or a user-defined export specification, notice that your exported string values are enclosed in double quotation marks. You won’t see that behavior when programmatically exporting with BASIC I/O functions. If you want your string data enclosed in some kind of text qualifier (e.g., double quotes), you will need to concatenate the text qualifiers in code yourself.
A better example of export data scrubbing would be if your data has embedded carriage return or line feed characters (perhaps in a memo field), and you wanted to replace the CrLf stuff with, say, a single space (“ “).
Best way to add export functionality to your apps is to create a class module that handles all your text exporting. Then you can add additional functionality as you need it, simply by adding additional properties and methods to your class, while keeping it all encapsulated in one place. You can then execute an export with code like:
Dim objTextExport As clsTextExport
Set objTextExport = New clsTextExport
‘Set objTextExport properties
.AppendToFile = False
.ExcludeFields = ""
.ExportDatabase = CurrentDb
.ExportFilename = "C:\Export.txt"
.ExportSource = "tblData"
.ExportType = "ASCII"
.FieldDelimiter = vbTab
.IncludeFieldNames = True
.RecordDelimiter = vbCrLf
.ReplaceWith = " "
.TextQualifier = Chr(34)
‘Call objTextExport methods