pls......urgent

erin_0502

Registered User.
Local time
Tomorrow, 04:46
Joined
Jul 25, 2007
Messages
20
anybody can help me how to get text file after transfer without the header.
this is my coding....

ption 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 i As Integer
Dim strFilename As String
Dim sExportLocation As String
Dim Expression As String
Dim returnValue() As String

Set db = CurrentDb()

sExportLocation = "N:\- Guest -\guestbcs\usrPrivate\irni\irni\access\"
For Each td In db.TableDefs 'Tables
If Left(td.Name, 4) <> "MSys" Then
strFilename = sExportLocation & td.Name & ".txt"
Debug.Print strFilename
DoCmd.TransferText acExportDelim, , td.Name, strFilename, 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 & 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



This is my example report....i wont to take out the red text.....

"Id","DesignOption","Name","Elevation"
311,,"Level 1",0.00
694,,"Level 2",3.99
239460,,"BASEMENT 4",0.00
245105,,"DATUM",-22.30
253637,,"Level gf",12.30
253638,,"Level 3",16.29
263777,,"Basement 2",6.00
263781,,"Basement 1",9.00
274998,,"Basement 3",9.00
275001,,"Basement gf",12.30
289602,,"Basement 4",3.00
289606,,"Basement 5",6.00
298326,,"Basement 6",0.00
298327,,"Basement 7",3.00



pls help me....
i must to solve this problem today....
 
This part:
DoCmd.TransferText acExportDelim, , td.Name, strFilename, True

Change to this:

DoCmd.TransferText acExportDelim, , td.Name, strFilename, False
 
wow.....
thank for everything....
i get the correct information from u.....
now my text file without header...............
 
Erin

Please
a) Put proper titles on your posts so that other people searching the forum can find your thread with its solution more easily.
b)Use the Code tags to surround you code so it is easier to read, The code tags are Code surrounded with square brackets and likewise /code at the end.
 

Users who are viewing this thread

Back
Top Bottom