Thanks to everyone for the help.

I will always know the length of a record, it will be fixed based on the file created and each record/row/field will be 4-9 characters in lengh.

I am not a wiz and am trying to simply apply a change without having to redesign file layouts or other areas of the code. I really appreciate all the help.

Let me give you an example:
TEST.TXT
1234
5678
2345
7654
6543

The first part of the code reads to a random 'record' number and loads that records value into a variable. For example the random record is 3, which contains 2345.

So the program now closes the file. (This is the old code, this is all working fine).

Now the change is I need to go back into record 3 and write over the value 2345 with ZZZZ.

So the file now becomes:
1234
5678
ZZZZ
7654
6543

I think I understand you are saying write the top of the file to a tempfile:
1234
5678

Then write ZZZZ

Then write the remainder of the file.

It seems like there should be a way I can get my location in the file when it is OPENed as OUTPUT, store that into a variable, example TmpLocation with the SEEK(1) function

Then CLOSE it and reOPEN it as BINARY/INPUT/RA, etc. and go directly to the position that was stored in TmpLocation.

The reason I want to try this way, is these files can become large (40Meg) in size and the program is already extremely slow.

Again, I really appreciate everyones support and guidance.

I have the following code to this point:

Code:
   ' Older code, reads a file and pulls out the required record. This file has CR+LF after each record, and the records are a fixed length in each file. all records within a given file are the same length.
    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
    ' Find out the current location of the file.
    tmpLocator = Seek(1) ' I added this line to get the current location.
    Close #1
    strTMKRecord = strRecord

    ' **Need help with the following, please**
    ' I am adding this code. if the strTMKRecord starts with a "Z", it has already been used.
    ' Otherwise, I just want to write over the record I just selected with Line Input above.
    ' The following code inserts "ZZZZZZ", but it is in the middle of a record and it adds 10 bytes to the file.
    If Mid(strTMKRecord, 1, 1) <> "Z" Then
        ' If we are to this point we have a valid Record, and now need to overwrite the record in the file.
        Open GcmdTMKFile For Binary Access Read Write As #1
        Seek #1, tmpLocator - len(strTMKRecord) ' back up over the record.
        Put #1, , String(Len(strTMKRecord), "Z") & vbNewLine
        Close #1
    End If
Again, thank you all for all the help.
kp