AccessGuruCarl
Programmer
Hello All...
I know have seen a function out here that does this, but after several different search senerio's I could locate it.
Basically...
I need to loop or read a text file until a specified point. Save that position.
Process what I've read...
Write it to a tmp.txt file for import
Import into a table
Then continue reading the text... and start the process again...
I create the txt file on the clients PC, it exports 4 tables into temp files that I then merge into 1 that gets emailed to us...
Here is the code that creates the txt file.
So basically the output is like so...
Placed it in a code block to keep it uniform.
I need each table section!
I can handle everything else mentioned in the steps... But looping the txt file for each section....
Thanks in advance...
AccessGuruCarl
Programmers helping programmers
you can't find a better site.
I know have seen a function out here that does this, but after several different search senerio's I could locate it.
Basically...
I need to loop or read a text file until a specified point. Save that position.
Process what I've read...
Write it to a tmp.txt file for import
Import into a table
Then continue reading the text... and start the process again...
I create the txt file on the clients PC, it exports 4 tables into temp files that I then merge into 1 that gets emailed to us...
Here is the code that creates the txt file.
Code:
For iLoop = 0 To 3 'Arrays use 0 as strating point unless Option Base
1 is set
iFile = FreeFile
'Export a table
DoCmd.TransferText acExportDelim, , arrTables(iLoop), fPath & arrTables
(iLoop) & ".txt", True
' Read the text file into a variable
fText = FileText(fPath & arrTables(iLoop) & ".txt")
' Write the text file to a temp file
Open uText For Append As #iFile
' Add the table name
Print #iFile, ">" & arrTables(iLoop)
' Add the value read into fText
Print #iFile, fText
' Close the file
Close #iFile
' Kill the export file
Kill fPath & arrTables(iLoop) & ".txt"
fText = ""
Next 'Get the next table
So basically the output is like so...
Placed it in a code block to keep it uniform.
Code:
>tbl_Title_Page
"ED_Number","Current_ECN","Current_Rel_Date","Drafter","Drafter_In","Drafte
r_Date","Mfg_Eng","Design_Eng","Name","BU","SheetNum","Customer_Name","Proj
ect_ECN_Level"
"Braid Sample","REV A",4/27/2007 0:00:00,"R JENENR","RJ",4/27/2007
0:00:00,,,"BRUSHLESS EXTERNAL POWER CBL","PVA",1,"PVA",
>tbl_Rev_History
"ECN_Date","ED_Number","ECN","Approved_by","ED_ID","First_Line","Last_Line"
,"Revisions","Rev_Letter","Row_Number"
4/27/2007 0:00:00,"Braid Sample","REV A","RJ",,,,"ORIGINAL RELEASE",,672
>tbl_ID_Labels
"Material","Format","ED_Number","Item_no","Ref","Line_1","Line_2","Line_3","Line_4","Line_5","Notes"
"954500","PVA/122-1540","Braid Sample",1,,"TRAC",,,,,"."
"954500","PVA/122-1540","Braid Sample",2,,"MOTOR",,,,,
"954500","PVA/122-1540","Braid Sample",3,,"CABINET",,,,,
>tbl_ED_Lines
"ED_Number","Line_no","MC","Basic_Matl","Qty","Cut_Length","End_1_Dest","En
d_1_Cell","End_1_Term","End_1_Strip","End_1_Tin","End_1_Slv_Line","End_1_Sl
v_Shrink","End_1_Slv_when","End_1_Mark_Code","End_1_Mark_Detail","End_1_Dai
sy_with","Cut_Length_End_2","End_2_Dest","End_2_Cell","End_2_Term","End_2_S
trip","End_2_Tin","End_2_Slv_Line","End_2_Slv_Shrink","End_2_Slv_when","End
_2_Mark_Code","End_2_Mark_Detail","End_2_Daisy_with","Notes","Term_1_AWG_Mi
n","Term_1_AWG_Max","Term_2_AWG_Min","Term_2_AWG_Max","Term_1_Insl_Min","Te
rm_1_Insl_Max","Term_2_Insl_Min","Term_2_Insl_Max","Lead_AWG","Lead_Insl","
Barrel_Type_1","Barrel_Type_2","Strip_1","Strip_2","Compat_1","Compat_2","T
erm_1_Compat","Term_2_Compat"
"Braid Sample",1,"S","734223",4,1.50,,,,,,,,,,,,,,,,,,,,,,,,"SHRINK OVER
BOTH CABLES.",,,,,,,,,,,,,,,,,,
I need each table section!
I can handle everything else mentioned in the steps... But looping the txt file for each section....
Thanks in advance...
AccessGuruCarl
Programmers helping programmers
you can't find a better site.