473,386 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Best way to import and update tables?

I have an Excel spreadsheet with 1000+ rows that I need to import into
an Access 2002 db once a month or so. I then need to use that
information to update any existing records(multiple fields may need
updating) and/or add any new records.

I figure one way is to just "brute force" it, i.e., import the
spreadsheet then run some code to do a sequential read thru the new
table and do lookups in the existing table and update whatever fields
may have changed. Not real elegant but seems workable.

Any other "cleaner" way of doing this?

URLs, code-snippets, etc. welcome. TIA

bill W

Nov 13 '05 #1
3 10932
If the Excel spreadsheet is in row/column arrangement, you can link it as
though it were an Access table. Then it should be (relatively) easy to run
queries to determine what needs to be updated. On the other hand, if the
Excel spreadsheet is the "authoritative source" for the information, you
could delete the existing table, and use it as the data source for a "make
table" query to create a new version.

Larry Linson
Microsoft Access MVP

"wildbill" <we*******@charter.net> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have an Excel spreadsheet with 1000+ rows that I need to import into
an Access 2002 db once a month or so. I then need to use that
information to update any existing records(multiple fields may need
updating) and/or add any new records.

I figure one way is to just "brute force" it, i.e., import the
spreadsheet then run some code to do a sequential read thru the new
table and do lookups in the existing table and update whatever fields
may have changed. Not real elegant but seems workable.

Any other "cleaner" way of doing this?

URLs, code-snippets, etc. welcome. TIA

bill W

Nov 13 '05 #2
Linking is not a good option as the spreadsheet comes from a web-site
in another location. Oh...and the name of the spreadsheet may change
and the name of the worksheet may change

Zapping the existing table won't work either as there are
fields/information that are not in the original-spreadsheet and I don't
want to lose the info.

Nov 13 '05 #3
"wildbill" wrote
Linking is not a good option as the
spreadsheet comes from a web-site
in another location. Oh...and the
name of the spreadsheet may change
and the name of the worksheet may
change
You could download the spreadsheet, rename it, and link on the local
machine, but that may have no advantage over importing the spreadsheet into
a table.

You can create Queries including both the old and new tables, to return the
new values for fields where they exist, then use those queries as the Data
Source for an update Query, to replace the old values. It still does not
make much sense to check for differences... if the spreadsheet is the
"authoritative source", you can just overlay those fields that are in the
spreadsheet. If the values are identical, nothing will change; if there's a
new value, they will change just as if you had checked and only replaced
those where there is a difference.

You'll probably also need a Query to find Records in the Spreadsheet data
that don't exist in the table and use an Append Query to add them. Update
does not handle that case.
Zapping the existing table won't
work either as there are fields /
information that are not in the
original-spreadsheet and I don't
want to lose the info.


The update approach I suggest above works on individual Fields, rather than
replacing the whole table, as I had previously suggested.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Doug Baroter | last post by:
Hi, One of my clients has the following situation. They use Access DB for data update etc. some business functions while they also want to view the Access data quickly and more efficiently in...
5
by: yvan | last post by:
Approximately once a month, a client of ours sends us a bunch of comma-delimited text files which I have to clean up and then import into their MS SQL database. All last week, I was using a Cold...
4
by: Steve Jorgensen | last post by:
I'm restarting this thread with a different focus. The project I'm working on now id coming along and will be made to work, and it's too late to start over with a new strategy. Still, I'm not...
1
by: Chris Uwins | last post by:
Hi there, i know theres a number of ways I can achieve this but want to know the best, (but still quite simple). Up until a year ago I never used Access but have designed a few databases for...
2
by: jayderk | last post by:
I am writing an application with a form that once started will run for several minutes(an import). I would like the progress bar on the form to update with the progress of the import. I would also...
5
by: Ryan Liu | last post by:
I have an application need export ane import data of projects. There are about 10 database tables releated to one project. 3 of them each could have up to 100K lines data. I can export all data...
11
by: kaisersose1995 | last post by:
Hi, I've got an import procedure working, using a standard import specification to import a .csv file into a temporary table. The problem i'm having is that i have 4 different sets of borrower...
1
by: tezza98 | last post by:
I need some help. Im using a dtsrun command to import 9 tables into an Access database, most of the tables have about 1000 rows, but one has 20000+ rows and grows everyday. Im Using Access 2003...
1
by: Rhadamanthys | last post by:
Hello All I am a relative beginner to SQL databases & new to this forum, so please bear with me if my query is too basic and advise if this question belongs somewhere else I began working at a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...

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.