473,387 Members | 1,463 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,387 software developers and data experts.

Archiving data

rcollins
234 100+
I'm back, thanks for the help with the import, our first import went with minor clitches, mostly with the spreadsheets. On to the next stage. I need to archive the main table of my database. Basically, I just want all of the info to move to fromtblClientContact to tblClientContactArchive. Please advise
May 15 '07 #1
7 1172
ADezii
8,834 Expert 8TB
I'm back, thanks for the help with the import, our first import went with minor clitches, mostly with the spreadsheets. On to the next stage. I need to archive the main table of my database. Basically, I just want all of the info to move to fromtblClientContact to tblClientContactArchive. Please advise
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3. DoCmd.CopyObject , "tblCientContactArchive", acTable, "tblClientContact"
  4.  
  5. 'DELETE ALL Records from tblClientContact
  6. DoCmd.SetWarnings False     'don't feel like seeing Deletion Prompts!
  7.   strSQL = "DELETE * FROM tblClientContact;"
  8.   DoCmd.RunSQL strSQL
  9. DoCmd.SetWarnings True
May 15 '07 #2
rcollins
234 100+
So, real screwy behavior. When I run this code, it copies over, then deletes from the original table. As soon as it deletes from the original, then all of the data in the archive is gone also. If this isn't bad enough, when I paste the info back in my original table, the data in the archive comes back. I looked in the link table manager to find that there is a link from the archive table to the original table. How can I use a table that is already created. If I make an archive table, it prompts to replace the existing one, then links the new one with the original table.
May 17 '07 #3
ADezii
8,834 Expert 8TB
So, real screwy behavior. When I run this code, it copies over, then deletes from the original table. As soon as it deletes from the original, then all of the data in the archive is gone also. If this isn't bad enough, when I paste the info back in my original table, the data in the archive comes back. I looked in the link table manager to find that there is a link from the archive table to the original table. How can I use a table that is already created. If I make an archive table, it prompts to replace the existing one, then links the new one with the original table.
You're right, this is real screwy behavior - will have to think on this one!
May 17 '07 #4
rcollins
234 100+
Did we ever find an answer to this?
May 24 '07 #5
ADezii
8,834 Expert 8TB
Did we ever find an answer to this?
I'm sorry but i've repeated this process on my PC over and over and over again, and had no problems at all. I can't imagine what would be causing this behavior. Just as a long shot, add a single line of code at the end (RefreshDatabaseWindow).
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3. DoCmd.CopyObject , "tblCientContactArchive", acTable, "tblClientContact"
  4.  
  5. 'DELETE ALL Records from tblClientContact
  6. DoCmd.SetWarnings False     'don't feel like seeing Deletion Prompts!
  7.   strSQL = "DELETE * FROM tblClientContact;"
  8.   DoCmd.RunSQL strSQL
  9. DoCmd.SetWarnings True
  10.  
  11. RefreshDatabaseWindow              'Add this line of code
May 24 '07 #6
rcollins
234 100+
So, n o good. I can't figure out why it would make the archive table linked to the main table
May 25 '07 #7
rcollins
234 100+
How about this.. I had to make 2 more querys, one to append to the archive table and one to delete the records from the original table. This worked great.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command30_Click()
  2.     If MsgBox("Are you sure you want to do this? This process will move all of the records for the past year to an 'archive' table!", vbYesNo) = vbYes Then
  3.         DoCmd.SetWarnings False
  4.  
  5.         'put new records in archive table
  6.         DoCmd.OpenQuery "qryAppentClientContactArchive"
  7.  
  8.         'deletes records from original table
  9.         DoCmd.OpenQuery "deleterecordsforarchive"
  10.  
  11.         DoCmd.SetWarnings True
  12.         MsgBox "All records have been archived.", vbInformation
  13.     End If
  14. End Sub
May 25 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: sandip | last post by:
Hi All, Can someone please help me with good and easy-to-use data archiving tools for DB2 database? Does anyone have previous experience with IBM DB2 Data Archive Expert tool? Is this a...
4
by: Paul H | last post by:
Could some one give me some pointers on basic archiving techniques? I have developed several databases but never been faced with this issue. Here is the basic scenario.. Suppose I have the...
3
bvdet
by: bvdet | last post by:
Following is an example that may provide a solution to you: """ Function makeArchive is a wrapper for the Python class zipfile.ZipFile 'fileList' is a list of file names - full path each name...
3
nurikoAnna
by: nurikoAnna | last post by:
how to data archiving? I need you help I have no idea how to start coding data archiving . Please help
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
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.