By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,009 Members | 2,859 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,009 IT Pros & Developers. It's quick & easy.

query to append and update?

P: n/a
MN
I have to import a tab-delimited text file daily into Access through a
macro. All of the data needs to be added to an existing table. Some of
the data already exists but may be updated by the imported text file. I
can update the data through an update query or append the entire import
table through an append query. Is there a way to combine the two so that
I can update existing records and append only new records (without
duplicating existing records)? Thanks.
Aug 21 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
not without VBA code no
or at least in a simple (correct) way
however having unique keys in the table U can append safely with access &
then run (probably inefficient) update queries to update the data

Pieter

"MN" <mn@mn.mn.invalidwrote in message
news:mn**********************@news.giganews.com...
>I have to import a tab-delimited text file daily into Access through a
macro. All of the data needs to be added to an existing table. Some of
the data already exists but may be updated by the imported text file. I
can update the data through an update query or append the entire import
table through an append query. Is there a way to combine the two so that
I can update existing records and append only new records (without
duplicating existing records)? Thanks.
--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4592 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
Aug 21 '06 #2

P: n/a
MN <mn@mn.mn.invalidwrote in
news:mn**********************@news.giganews.com:
I have to import a tab-delimited text file daily into Access
through a macro. All of the data needs to be added to an
existing table. Some of the data already exists but may be
updated by the imported text file. I can update the data
through an update query or append the entire import table
through an append query. Is there a way to combine the two so
that I can update existing records and append only new records
(without duplicating existing records)? Thanks.
Import the data to a temporary table.
Run the update query to set the changed values into the
permanent table.
run a delete query to remove records from the temporary table if
they already exist in the permanent table.
Import the remaining (new) records to the permanent table from
the temporary table.
Delete all records from the temporary table, so you are set for
the next cycle.

You could do this faster and better with some VB code, instead
of a macro.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 22 '06 #3

P: n/a
MN
In article <Xn**********************@66.150.105.47>,
Bob Quintal <rq******@sPAmpatico.cawrote:
MN <mn@mn.mn.invalidwrote in
news:mn**********************@news.giganews.com:
I have to import a tab-delimited text file daily into Access
through a macro. All of the data needs to be added to an
existing table. Some of the data already exists but may be
updated by the imported text file. I can update the data
through an update query or append the entire import table
through an append query. Is there a way to combine the two so
that I can update existing records and append only new records
(without duplicating existing records)? Thanks.
Import the data to a temporary table.
Run the update query to set the changed values into the
permanent table.
run a delete query to remove records from the temporary table if
they already exist in the permanent table.
How would I setup the delete query to only find the records that aren't
in the permanent table? Thanks.

Import the remaining (new) records to the permanent table from
the temporary table.
Delete all records from the temporary table, so you are set for
the next cycle.

You could do this faster and better with some VB code, instead
of a macro.
--
Bob Quintal

PA is y I've altered my email address.
Aug 22 '06 #4

P: n/a
MN <mn@mn.mn.invalidwrote in
news:mn**********************@news.giganews.com:
In article <Xn**********************@66.150.105.47>,
Bob Quintal <rq******@sPAmpatico.cawrote:
>MN <mn@mn.mn.invalidwrote in
news:mn**********************@news.giganews.com :
I have to import a tab-delimited text file daily into
Access through a macro. All of the data needs to be added
to an existing table. Some of the data already exists but
may be updated by the imported text file. I can update the
data through an update query or append the entire import
table through an append query. Is there a way to combine
the two so that I can update existing records and append
only new records (without duplicating existing records)?
Thanks.
Import the data to a temporary table.
Run the update query to set the changed values into the
permanent table.
run a delete query to remove records from the temporary table
if they already exist in the permanent table.

How would I setup the delete query to only find the records
that aren't in the permanent table? Thanks.
I would never set up a query to delete those that aren't in the
permanent table. I'd set up a query to append them to the
permanent table.

To delete those that are already in the permanent table from the
temp table so that i could later append those that are left, I
would "DELETE * from temptable WHERE primarykey IN (SELECT
primarykey from permanenttable);

substitute primarykey with the real name of whatever field is
the one which defines the uniqueness of the record, and the real
names for temptable and permanenttable

>
>Import the remaining (new) records to the permanent table
from the temporary table.
Delete all records from the temporary table, so you are set
for the next cycle.

You could do this faster and better with some VB code,
instead of a macro.
--
Bob Quintal

PA is y I've altered my email address.


--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 23 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.