View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson Greg Wilson is offline
external usenet poster
 
Posts: 747
Default Text file db where record already exists conundrum

BACKGROUND:
I have successfully written code that saves and imports to/from a .txt file
database. The data source is non-contiguous (in fact derives from two
worksheets) but I have successfuly resolved this. I save each data set to a
single line in the .txt file using a semicolon as a delimiter. Each data set
is identified by its date which starts the line followed by a semicolon and
then the rest of the data (semicolon dilimited). I use the Split function to
create an array of values when importing (works great).

Not done yet, but I want to create a different .txt file for each month of
data. This should be easy since the "Open xyz.txt For Append As #1" statement
will create a new file if it doesn't already exist. I intend to simply strip
the month/year from the data set's date and use this as the name when opening
the file. It should automactically create a new file with this name when the
month changes.

PROBLEM:
If a record already exists in the .txt file when saving and I either want to
overwrite the existing record or prevent duplication, then I can't come up
with a simple solution. Efforts so far are becoming extremely convoluted.
Googling hasn't been successful.

Hoping someone knows of simple working code that has resolved this or can
point me in the right direction. Note that I am working extremely long hours
and can't spend much time on research. I need to keep it simple and
preferably in familiar territroy. I need to get this up and running for
someone else to take over.

Much appreciative,

Greg