Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export with pipe record delimiter?

Status
Not open for further replies.

lisaharris

Programmer
Feb 12, 2007
130
US
Is there a way to export a table into a text file with a pipe record delimiter?

The table is one field wide, record count will vary. It must be exported with a pipe between the records rather than a CR/LF and I can't figure out how to accomplish this!!

Any help would be greatly appreciated!


__________
Veni, Vidi, Visa: I came, I saw, I charged it.
 
You could try GetString.

Syntax
Variant = recordset.GetString(StringFormat, NumRows, ColumnDelimiter, RowDelimiter, NullExpr)


Code:
Sub DelimTabs()
Dim rs2 As ADODB.Recordset

Set rs2 = CreateObject("ADODB.Recordset")
rs2.ActiveConnection = CurrentProject.Connection

rs2.Open "SELECT * FROM Sheet1"

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.CreateTextFile("Out.txt")

f.WriteLine rs2.GetString(adClipString, 2, ",", "|", "-")
f.Close
End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top