getting access to txt files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a question. I have a form that adds a record to a table but I also
want to append that information to the end of a txt file. Can I do this and
if so how?

Thanks in advance
Brian Bjelland
 
bbdobuddy said:
Hi,

I have a question. I have a form that adds a record to a table but I
also want to append that information to the end of a txt file. Can I
do this and if so how?

Thanks in advance
Brian Bjelland

If you only want to add the one record you just added to the text file,
as opposed to exporting the whole table, you probably have to use code
in the form's AfterInsert event to use standard VB I/O statements to
open the file for Append, write a line composed of the data from the
record, and close the file.

If you may add multiple records from the form, and you want to copy them
all to the text file, you may be able to do it all when the form is
closed -- but only if there's some way to determine by inspection which
records were added during this session with the form. If that is so,
you could open a recordset on a query of the table that returns only the
newly added records, then open the text file, loop through the recordset
writing out the records, and close the recordset and file when you're
done.
 
Back
Top