import txt file

  • Thread starter Thread starter Irene
  • Start date Start date
I

Irene

i have a txt file which the extension is ".csv". i want to link it to my
access. i have success link it to access. but i want after done all updating,
i want to delete the txt file. i want the system after update then will open
the txt file to let me delete the data inside the file. but it cant, cos the
file is link and it is lock. so anybody have any suggestion to me? i want to
do like this because i scare the user will go to click the update button
twice, and it will update the same data twice. anybody can help?
 
Irene,
you can unlink the text file by deleting it from the database window.
This only removes the link, it doesn't delete the text file from the
computer or network.
After you have unlinked the text file, if you want to delete it you use the
Kill statement.

Kill "C/Temp/TheTextFile.csv"

The above will delete a file called TheTextFile.csv in the folder called
Temp on the C drive.


Jeanette Cunningham -- Melbourne Victoria Australia
 
thanks for the reply! but i still have the question. if i unlink the file
then delete the fie, if the next day i want to update the file, then need
link it again? the user they will export the file everyday and use the access
to update the data which is using the access. then after all updating, then
want it delete the file due to wont happen duplicate the data. so how is it?
 
Irene,
the way to prevent importing duplicates is to set up a unique index on the
table.
Here is an explanation of an unique index.
Imagine a table with Last Name, First Name, Address, City.
If I set a unique index using all 4 fields, a new record can only be added
to the table if it is different from all the other records in that table.
If I had a record with
-->Irene Adams 2 Apple St New York
already in the table, and I tried to add another record for
-->Irene Adams 2 Apple St New York

The unique index would prevent the second record going into the table.
It is like a gate keeper who only allows one of everything through the gate.

To set up a unique index, open the table in design view.
Open the index dialog (toolbar/ribbon)
On a new line type the name for the index - NoDupes and the first field
Go to the lower pane of the table and set the Unique property to Yes
Back to the upper pane, complete the remaining fields for the index while
leaving the name field blank.

Here is a unique index called No Dupes for the example above.

Index Name Field Name Sort Order
-------------------------------------------
No Dupes Last Name Ascending
First Name Ascending
Address Ascending
City Ascending


Save the table


Jeanette Cunningham -- Melbourne Victoria Australia
 
hi Jeanette Cunningham,

thanks for your help!

Jeanette Cunningham said:
Irene,
the way to prevent importing duplicates is to set up a unique index on the
table.
Here is an explanation of an unique index.
Imagine a table with Last Name, First Name, Address, City.
If I set a unique index using all 4 fields, a new record can only be added
to the table if it is different from all the other records in that table.
If I had a record with
-->Irene Adams 2 Apple St New York
already in the table, and I tried to add another record for
-->Irene Adams 2 Apple St New York

The unique index would prevent the second record going into the table.
It is like a gate keeper who only allows one of everything through the gate.

To set up a unique index, open the table in design view.
Open the index dialog (toolbar/ribbon)
On a new line type the name for the index - NoDupes and the first field
Go to the lower pane of the table and set the Unique property to Yes
Back to the upper pane, complete the remaining fields for the index while
leaving the name field blank.

Here is a unique index called No Dupes for the example above.

Index Name Field Name Sort Order
-------------------------------------------
No Dupes Last Name Ascending
First Name Ascending
Address Ascending
City Ascending


Save the table


Jeanette Cunningham -- Melbourne Victoria Australia
 
Back
Top