transfer text

Joined
Jul 27, 2007
Messages
1
Reaction score
0
hello friends.........................

i need your help....

this is my coding for this problem, i want to change the delimited using (|)
until now i cannot solve this problem....pls help me....

Option Compare Database
Option Explicit

'Public Sub Main()
'ExportDatabaseObjects()
'End Sub

'Public Sub ExportDatabaseObjects()
Public Sub Main()
On Error GoTo Err_ExportDatabaseObjects

Dim db As Database
'Dim db As DAO.Database
Dim td As TableDef
'Dim d As Document
'Dim c As Container
Dim i As Integer
Dim sExportLocation As String

Set db = CurrentDb()

sExportLocation = "N:\- Guest -\guestbcs\usrPrivate\irni\text file\"
For Each td In db.TableDefs 'Tables
If Left(td.Name, 4) <> "MSys" Then
DoCmd.TransferText acExportDelim, , td.Name, sExportLocation & td.Name & ".txt", True
DoCmd.RunMacro "table_name"
End If
Next td

For i = 0 To db.QueryDefs.Count - 1
Application.SaveAsText acQuery, db.QueryDefs(i).Name, sExportLocation & "Query_" & db.QueryDefs(i).Name & ".txt"
Next i

Set db = Nothing


MsgBox "All table been exported as a text file to " & sExportLocation, vbInformation

Exit_ExportDatabaseObjects:
Exit Sub

Err_ExportDatabaseObjects:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_ExportDatabaseObjects
End Sub


my supervisor want the input come out like this using the "|" delimiter...

745395|745393|86961||||0.07|3.14||311||||||ST|||m2|||
746427|746425|86961||||0.07|0.06||311||||||ST|||m|||
749978|749976|86961||||0.04|0.04||311||||||ST|||m|||
751819|751817|86961||||0.07|0.07||311||||||ST|||m|||
757316|757337|86961||||0.05|2.56||311|0|6.43|0.01|3||ST|||m2|||
757372|757337|86961||||0.05|2.79||694|0|6.50|-1.52|3||ST|||m2|||
757626|757624|86961||||0.03|2.75||311||||||ST|||m2|||
759779|759777|86961||||0.07|0.07||311||||||ST|||m|||
760870|760868|86961||||0.03|1.39||311||||||ST|||m2|||
760992|760990|86961||||0.03|2.75||311||||||ST|||m2|||
761161|761159|86961||||0.03|1.39||311||||||ST|||m2|||


But now my report come out like this using "," delimiter...

745395,745393,86961,,,,0.07,3.14,,311,,,,,,"ST",,,"m2",,,
746427,746425,86961,,,,0.07,0.06,,311,,,,,,"ST",,,"m",,,
749978,749976,86961,,,,0.04,0.04,,311,,,,,,"ST",,,"m",,,
751819,751817,86961,,,,0.07,0.07,,311,,,,,,"ST",,,"m",,,
757316,757337,86961,,,,0.05,2.56,,311,0,6.43,0.01,3,,"ST",,,"m2",,,
757372,757337,86961,,,,0.05,2.79,,694,0,6.50,-1.52,3,,"ST",,,"m2",,,
757626,757624,86961,,,,0.03,2.75,,311,,,,,,"ST",,,"m2",,,
759779,759777,86961,,,,0.07,0.07,,311,,,,,,"ST",,,"m",,,
760870,760868,86961,,,,0.03,1.39,,311,,,,,,"ST",,,"m2",,,
760992,760990,86961,,,,0.03,2.75,,311,,,,,,"ST",,,"m2",,,

can u help me....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top