|
 |
access thread: DoCmd.TransferText limitation??
Message #1 by "Kok Chuan" <lkokchuan@y...> on Mon, 30 Dec 2002 12:53:02
|
|
As I know, that the DoCmd.TransferText is import record from a text file.
And when the existing table have records already and the record of text
file to import is trying to update the existing table record. I encouter
limitation in here, the existing table would not update the record which
import from text. Anyone know how to solve that? Thank.
Message #2 by "Bob Bedell" <bobbedell15@m...> on Mon, 30 Dec 2002 18:10:59 +0000
|
|
If the table you're importing to already exists, TransferText appends
the imported data to the existing table. If the table you're importing
to doesn't already exist, Access creates a new table with the imported
data. TransferText can't update individual records in an existing table
(couldn't quite make out if that is what you were referring to).
If you want to "update" the existing table (i.e., delete it and recreate
it with the newly imported data) you can do the following:
Sub UpdateImportData()
On Error Resume Next
DoCmd.DeleteObject ObjectType:=acTable, _
objectname:="tblImportedData"
DoCmd.TransferText transfertype:=acImportDelim, _
tablename:="tblImportedData", _
filename:="C:\Temp\ImportData.txt"
End Sub
Best,
Bob
>From: "Kok Chuan" <lkokchuan@y...>
>Reply-To: "Access" <access@p...>
>To: "Access" <access@p...>
>Subject: [access] DoCmd.TransferText limitation??
>Date: Mon, 30 Dec 2002 12:53:02
>
>As I know, that the DoCmd.TransferText is import record from a text file.
>And when the existing table have records already and the record of text
>file to import is trying to update the existing table record. I encouter
>limitation in here, the existing table would not update the record which
>import from text. Anyone know how to solve that? Thank.
_________________________________________________________________
MSN 8 with e-mail virus protection service: 3 months FREE*.
http://join.msn.com/?page=features/virus&xAPID=42&PS=47575&PI=7324&DI=7474&SU=
http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_eliminateviruses_3mf
Message #3 by "Kok Chuan" <lkokchuan@y...> on Tue, 31 Dec 2002 07:18:32
|
|
Thank for your response. Anyway, I try to import a text file into the
table on regurlarly period basic. The first time text file is import into
a blank table and second text file will be update imformation for that
table, so it is not a best way to delete the original table, create and
import again.
Did you have any other idea to use to import data while will update the
value in table?
Message #4 by "Basheer, Khyamuddin" <Khyamuddin_Basheer@a...> on Tue, 31 Dec 2002 00:25:01 -0700
|
|
Another way to do this is to have a temp table into which text file is
imported and use this temp table to update you master table which has
the details of previously imported text files. I use this method is my
application and it works fine.
rgds
Khyamuddin Basheer
APL-Jeddah
Saudi Arabia
Tel 00966-2-6697397 Ext 32
Fax 00966-2-6673212
-----Original Message-----
From: Kok Chuan [mailto:lkokchuan@y...]
Sent: Monday, December 30, 2002 11:19 PM
To: Access
Subject: [access] Re: DoCmd.TransferText limitation??
Thank for your response. Anyway, I try to import a text file into the
table on regurlarly period basic. The first time text file is import
into
a blank table and second text file will be update imformation for that
table, so it is not a best way to delete the original table, create and
import again.
Did you have any other idea to use to import data while will update the
value in table?
Message #5 by "Steve Klein" <Stephen@K...> on Tue, 31 Dec 2002 07:49:00 -0000
|
|
If you do not require a fixed relationship with the table do the following
sustain the link to your external file as a linked table.
Delete the table and then run a make table query from the linked text file
compact the database
If you need to sustain table relationships
sustain the link to your external file as a linked table.
delete all rows from the table
run an append query from the external linked file
Steve K
-----Original Message-----
From: Basheer, Khyamuddin [mailto:Khyamuddin_Basheer@a...]
Sent: 31 December 2002 07:25
To: Access
Subject: [access] Re: DoCmd.TransferText limitation??
Another way to do this is to have a temp table into which text file is
imported and use this temp table to update you master table which has the
details of previously imported text files. I use this method is my
application and it works fine.
rgds
Khyamuddin Basheer
APL-Jeddah
Saudi Arabia
Tel 00966-2-6697397 Ext 32
Fax 00966-2-6673212
-----Original Message-----
From: Kok Chuan [mailto:lkokchuan@y...]
Sent: Monday, December 30, 2002 11:19 PM
To: Access
Subject: [access] Re: DoCmd.TransferText limitation??
Thank for your response. Anyway, I try to import a text file into the
table on regurlarly period basic. The first time text file is import into
a blank table and second text file will be update imformation for that
table, so it is not a best way to delete the original table, create and
import again.
Did you have any other idea to use to import data while will update the
value in table?
|
|
 |