473,788 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Import New Data File - Archive Now Old Data File

I wonder if someone can help me with a small conundrum I am having.
This is what I want to achieve:

Scenario
--------
Each week, I import an excel spreadsheet called Week1.xls into an
access database. This table is then called Week1Data.

Already in the database is the table from the previous weeks import,
which is compared to the latest file, this file was called Week1Data
last week but is now called Week2Data.

There is a collection of past weeks imports in the database for
historic searching. This builds each week.

Problem
-------
How do I rename last weeks Week1Data to make it Week2Data? ..and then
when I do another import next week, move Week2Data into an archive by
calling it Week3Data etc., So, my latest import will always be
Week1Data with the previous weeks Week1 now renamed Week2 with that
previous weeks Week2 now named Week3.

Thanks for any help!

Neil

Nov 13 '05 #1
4 1866
Neil:

You can rename the tables using the TableDefs collection of the Database
object in DAO. You will need a reference to the DAO object library, of
course. For example:

Function RenameTables()
Dim tdf As TableDef
Dim db As Database

Set db = CurrentDb

Set tdf = db.TableDefs("W eek2Data")
tdf.Name = "Week3Data"
Set tdf = db.TableDefs("W eek1Data")
tdf.Name = "Week2Data"

RefreshDatabase Window

Set db = Nothing
Set tdf = Nothing

End Function

You will need to consider the possibility that Week3Data already exists
before the renaming process begins and how to handle this outcome, as well
as checking to make sure that both Week1Data and Week2Data currently exist.
This can be done by iterating through the TableDefs collection using a For
Each loop and checking the Name property each TableDef, or alternatively by
using error trapping.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"Neil10365" <ne*******@gmai l.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
I wonder if someone can help me with a small conundrum I am having.
This is what I want to achieve:

Scenario
--------
Each week, I import an excel spreadsheet called Week1.xls into an
access database. This table is then called Week1Data.

Already in the database is the table from the previous weeks import,
which is compared to the latest file, this file was called Week1Data
last week but is now called Week2Data.

There is a collection of past weeks imports in the database for
historic searching. This builds each week.

Problem
-------
How do I rename last weeks Week1Data to make it Week2Data? ..and then
when I do another import next week, move Week2Data into an archive by
calling it Week3Data etc., So, my latest import will always be
Week1Data with the previous weeks Week1 now renamed Week2 with that
previous weeks Week2 now named Week3.

Thanks for any help!

Neil
Nov 13 '05 #2
Rather than importing them as separate files each week, why not append them
all to the same table. You just need a date field to identify which week
each record belongs to.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
"Neil10365" <ne*******@gmai l.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
I wonder if someone can help me with a small conundrum I am having.
This is what I want to achieve:

Scenario
--------
Each week, I import an excel spreadsheet called Week1.xls into an
access database. This table is then called Week1Data.

Already in the database is the table from the previous weeks import,
which is compared to the latest file, this file was called Week1Data
last week but is now called Week2Data.

There is a collection of past weeks imports in the database for
historic searching. This builds each week.

Problem
-------
How do I rename last weeks Week1Data to make it Week2Data? ..and then
when I do another import next week, move Week2Data into an archive by
calling it Week3Data etc., So, my latest import will always be
Week1Data with the previous weeks Week1 now renamed Week2 with that
previous weeks Week2 now named Week3.

Thanks for any help!

Neil

Nov 13 '05 #3
Thanks for getting back to me so soon, that's much appreciated!

I think the appending to the same table may be the way to go, it
definately seems an easier solution to implement, but that's only
because I'm relatively inexperienced in Access.

Neil

Nov 13 '05 #4
I am in business to provide fee-based help. If you want help with what you
are doing, contact me at my email address below.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
"Neil10365" <ne*******@gmai l.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Thanks for getting back to me so soon, that's much appreciated!

I think the appending to the same table may be the way to go, it
definately seems an easier solution to implement, but that's only
because I'm relatively inexperienced in Access.

Neil

Nov 13 '05 #5

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

Similar topics

43
2521
by: Dan Perl | last post by:
Here is a python feature that I would like: to be able to import modules from an archive like the jar files in Java. Maybe a regular tar file? Maybe a python specific file type, let's call it a 'par' file? It would be useful in packaging an python library. Sure, there's always the python packages, but a single file instead of a whole directory tree would be more convenient. I am particularly interested because I am working on a...
14
10929
by: Demetris | last post by:
Hello people! I have a table with more than 30 million rows,a lot of columns and indexes. We need to change a column which is dec(15,2) and nullable to have a default value of zero. As I know you cannot alter a column unless it is varchar. I was thinking to export the whole table in ixf format, create the new table with the new definition and then import with insert into. Or rename the original table, create a new one and insert into new...
0
2677
by: DataFreakFromUtah | last post by:
Hello! No question here, just a procedure for the archive. Search critera: count records imported count data imported count number of rows imported count number of records imported record import count automatically import and count records prompt for number of records imported import count auto-import records autoimport records count records before and after
12
11094
by: =?Utf-8?B?am9uaWdy?= | last post by:
I wrote a simple VB.NET application that imports and edits CSV files. Now I’d like to “lock” the raw (pre-import) CSV files so these cannot be opened separately. It is not high-sensitive data, I just don’t want folks to peek in the files. So time-consuming encryption is not necessary, just a simple password-to-open that I can program in my application so it internally opens the imported CSV file would be perfect, but I can’t...
1
2781
by: Dave | last post by:
Hello, I've been given the job of recovering a database. It's mysql, version unknown but i'd suspect probably 3 maybe 4 certainly not 5. Apparently the host provider where this was didn't set up the backups right, because the guy gave me the db files not database dumps and i am uncertain what to do with them. I'd like to bring them in to a mysql installation and take a look at the data contained. If it's valid i.e. what has been requested...
4
1841
by: WillMiller | last post by:
Hi, I'm currently attempting to write a small Access Database which carries out the following tasks : 1. Imports Submission files (of a text variety) to a table using TransferText on a daily basis (many files into 1 table) 2. Imports Reject Files files (again of a text variety) to another table using Transfer Text. (again, daily, many files into 1 table) 3. Run a query which reports all submissions that haven't had a matching...
1
1777
by: fts2012 | last post by:
follow the dive into python ----------------------------------------------------------------- ----------------------------------------------------------------- I append the filepath of <<dive into python>>'s examples into sys.path,but ----------------------------------------------------------------- Traceback (most recent call last): File "<pyshell#5>", line 1, in <module>
0
1111
by: Gabriel Genellina | last post by:
En Fri, 13 Jun 2008 20:01:56 -0300, Dan Yamins <dyamins@gmail.com> escribi: Note that if you execute dir() at this point, you'll see the Operations name, *not* Operations.archive. The statement "import Operations.archive" first tries to locate and load a module named Operations - and *that* name is added to the current namespace, not Operations.archive (which is an invalid name by itself).
2
3006
by: BlackEyedPea | last post by:
Hi I have no coding experience but am using access 2003 on XP in the hope that I can find some code that will.... Search a folder in my network & import any excel spreadsheets it finds within that folder, putting the data into one large access table. All the spreadsheets have the same layout although for some bizarre reason (I didn't archive them you see!!!) they have different file names. I have already found some code which I include...
0
10370
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
10177
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...
1
10113
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
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
7519
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
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
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
3
2896
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.