Hello i am new to programming in access. i am facing a problem in creating a text file from access 97.
i need to create a fixed length text file and i read from access tables and will create the text file and will write the lines in text file, the delimter for separating values is 'space'. as the number of records to be read and write one record as one line. The values i write in the lines i procure them from the table aand write to the text file. the time to process is huge. is there any other faster way to create text file and write data to the text file to bring down the processing time.
i am givng the sample code how i am handling.please give suggestions to improve. using access97 on winnt 4
Dim FilePathAs String
Dim fs As variant
Dim a As variant
Dim db As Database
db = CurrentDb
Dim recxl As Recordset
Set recxl = CurrentDb.OpenRecordset("NEWFILE", dbOpenDynaset)
Dim str1, str2 As String
str1 = recxl!Customer
str2 = recxl!SocialFilePath = "C:/AUDIT/RPT_FILE/" + "AR04222003.txt"
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.Createtextfile(FilePath, True)
'write the header
a.writeline ("H" + Chr(160) + "NAR" + Chr(160) + Chr(160) + "HRD")
'write the records
a.writeline ("C" + Chr(160) + str1 + Chr(160) + Chr(160)+ Chr(160) + Chr(160) + str2160) + Chr(160)+"RCT")
' write the trailer
a.writeline ("T" + Chr(160) + "NAR" + Chr(160) + Chr(160) + "TRL")
set recx1 = Nothing