Hello:
I have some code that reads to a certain record in a text file, then extracts that record. That all works fine.
Now I need to OVERWRITE that same record once it is used.
How do I open the file as Output, read to a location then write over it? I hope this is possible without have to parse the file into temp files.
' Now I need to write "XXXXX" over the record I just extractedCode:' This section works as designed. It goes to a random record in the file Open GcmdTMKFile For Input As #1 Randomize intRandom = Int((GintRecCount * Rnd) + 1) ' Generate random value between 1 and TmpRecCount ' Loop through file until you get to the TmpRandom Record, then exit FOR NEXT LOOP For X = 1 To intRandom Line Input #1, strRecord Next Close #1 strTMKRecord = strRecord
Any help is greatly appreciated.Code:Open GcmdTMKFile For Output As #1 For X = 1 To intRandom Line Input #1, strRecord ' I get an error because I have opened the file for Output Next Print #1, "XXXXX" Close #1
thanks.
kpierce




Reply With Quote