Thanks for your input, actually incrementing the variable is not the problem. The problem is assigning that value to a new record when it is written. I need to get the value of the refNum in the last record of the file, increment it, assign the new refNum value to an new record, an...