find and replace using an access table and a text file

  • Thread starter Thread starter smith7255
  • Start date Start date
S

smith7255

I have a text file called c:\textfile.txt and an Access database with a table
called Accounts. In the Accounts table there are two fields, Old and New.
There are about 200 records in this table. Is there a way for Access to
interact with this text file? I would like to search the text file for any
of the values in the Old field in the Accounts table and replace them with
the value in the New field. Can this be done?
 
Thanks Alex, but the text file is not a flat file format. It is a financial
document that is already formatted to print on an official form. Before I
had to use a tool to pull all the information into a flat file and then
reformat it so it would be able to print on the form, I figured it would be
easier to see if Access could search the external text file with the data in
the access table and replace it with the data in the access table. i did
find a script on the web, but it was only for finding one value and replacing
it many times. I am looking for multiple values and replacing them once. I
don't know how to write a script that would look at the table's field instead
of a word in quotation". Any ideas?

Alex said:
Hi,
try to import or link text file and use it in update query
I have a text file called c:\textfile.txt and an Access database with a
table
[quoted text clipped - 4 lines]
of the values in the Old field in the Accounts table and replace them with
the value in the New field. Can this be done?
 
Hi,
then you can try to read text file into string variable, then do required
modifications using replace function and then save it back. sample code to
read/write text file you can find on internet, for example here
www.freevbcode.com

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

smith7255 said:
Thanks Alex, but the text file is not a flat file format. It is a
financial
document that is already formatted to print on an official form. Before I
had to use a tool to pull all the information into a flat file and then
reformat it so it would be able to print on the form, I figured it would
be
easier to see if Access could search the external text file with the data
in
the access table and replace it with the data in the access table. i did
find a script on the web, but it was only for finding one value and
replacing
it many times. I am looking for multiple values and replacing them once.
I
don't know how to write a script that would look at the table's field
instead
of a word in quotation". Any ideas?

Alex said:
Hi,
try to import or link text file and use it in update query
I have a text file called c:\textfile.txt and an Access database with a
table
[quoted text clipped - 4 lines]
of the values in the Old field in the Accounts table and replace them
with
the value in the New field. Can this be done?
 
Thank you! I will take a look at that site.

Alex said:
Hi,
then you can try to read text file into string variable, then do required
modifications using replace function and then save it back. sample code to
read/write text file you can find on internet, for example here
www.freevbcode.com
Thanks Alex, but the text file is not a flat file format. It is a
financial
[quoted text clipped - 22 lines]
 
Back
Top