473,657 Members | 2,763 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

query to append and update?

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
4 7383
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.inval idwrote in message
news:mn******** **************@ news.giganews.c om...
>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
MN <mn@mn.mn.inval idwrote in
news:mn******** **************@ news.giganews.c om:
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
MN
In article <Xn************ **********@66.1 50.105.47>,
Bob Quintal <rq******@sPAmp atico.cawrote:
MN <mn@mn.mn.inval idwrote in
news:mn******** **************@ news.giganews.c om:
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
MN <mn@mn.mn.inval idwrote in
news:mn******** **************@ news.giganews.c om:
In article <Xn************ **********@66.1 50.105.47>,
Bob Quintal <rq******@sPAmp atico.cawrote:
>MN <mn@mn.mn.inval idwrote 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5240
by: John | last post by:
Hi - I am trying to perform a simple append query, with no luck. I have a table (MktPrices) that has the following fields: BondID, PriceDate, Price. The objective is to allow the user to input a date and have the append query create a new record for each BondID, using the input date and the most recent price - which the user can then update on a tabular form. I have created a totals query (qryMostRecentPrice) which selects the most...
2
5781
by: JMCN | last post by:
hi i need some advice on whether if it would be better to use an append query or an update query. here is the situation, i have linked another database table to my current database. then i created a query for the linked database but eventually i need to have this query to be constantly updated and append to another table in the current database. i hope i'm not too vague but i have no idea if i should use an update or an append query....
5
4469
by: deko | last post by:
How to run action query against linked table? I have an Access 2003 mdb with an Excel 2003 Workbook as a linked table. When I attempt to run an action query against the linked table I get this error: Deleting data in a linked table is not supported by this ISAM. From what I understand, indexed sequential access method (ISAM) drivers are used to update "non-Microsoft" file formats. So why doesn't Access
2
5779
by: JMCN | last post by:
hi i have a general question regarding append queries in access 97. each week i need to update my table(tblonlinereg) with new or modified records. firstly, i import the text file into my database and then i create a basic append query that appends the new records to the table(tblonlinereg). this works great if the field is greater than the last record appended ( where: tempID > 198 ) but how would i update/append the modifications...
7
5084
by: rednexgfx_k | last post by:
All, Problem Summary: I've running about 30 make table queries via VBA in Access 2000, and my database goes from 14,000k to over 2,000,000k. In addition, the longer the procedure runs, the bigger the performance hit VBA takes. I'm wondering how to prevent or reduce this. Details: I have a database table of queries I want to run. This table contains the query name, the SQL text of the query, the name of the target table, and whether...
1
1886
by: jpr | last post by:
Friends, I would like some help with a code that allows me to run an append query only if a specific field is not already stored into another table. Example. I add a new customer to my database using table1. I type his SSN. The code should check if this SSN is already present in another table (table2). If yes, so the code should skip the append query and just update any modified record included the SSN.
6
5012
by: Dixie | last post by:
I have asked this question before, but I could not get the suggested solution work. So I will give more details this time. I have an append query that adds several hundred records to a table into a text field. Next to this text field is a separate Number (Single) field with a unique ID number for the entry. I want each number to be 1 more than the previous entry's number to keep it unique (I don't want autonumbering for this, as I...
0
1697
by: jon | last post by:
Hi there, I'm brand new to Access and may be trying to do too much too soon, but I wanted to get some expert advice on how the best way to go about what I am trying to accomplish would be. I am trying to modify the Microsoft Template at the following address (http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033) to work as an issues tracker that imports and updates the issues from a SQL 2005...
16
3487
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for renaming the duplicate records? My thinking was to take the results of the duplicate query, and somehow have it number each line where there is a duplicate (tried a groups query, but "count" won't work), then do an update query to change the duplicate to...
0
8394
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.