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
7 1172
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
- Dim strSQL As String
-
-
DoCmd.CopyObject , "tblCientContactArchive", acTable, "tblClientContact"
-
-
'DELETE ALL Records from tblClientContact
-
DoCmd.SetWarnings False 'don't feel like seeing Deletion Prompts!
-
strSQL = "DELETE * FROM tblClientContact;"
-
DoCmd.RunSQL strSQL
-
DoCmd.SetWarnings True
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.
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!
Did we ever find an answer to this?
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). - Dim strSQL As String
-
-
DoCmd.CopyObject , "tblCientContactArchive", acTable, "tblClientContact"
-
-
'DELETE ALL Records from tblClientContact
-
DoCmd.SetWarnings False 'don't feel like seeing Deletion Prompts!
-
strSQL = "DELETE * FROM tblClientContact;"
-
DoCmd.RunSQL strSQL
-
DoCmd.SetWarnings True
-
-
RefreshDatabaseWindow 'Add this line of code
So, n o good. I can't figure out why it would make the archive table linked to the main table
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. -
Private Sub Command30_Click()
-
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
-
DoCmd.SetWarnings False
-
-
'put new records in archive table
-
DoCmd.OpenQuery "qryAppentClientContactArchive"
-
-
'deletes records from original table
-
DoCmd.OpenQuery "deleterecordsforarchive"
-
-
DoCmd.SetWarnings True
-
MsgBox "All records have been archived.", vbInformation
-
End If
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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
|
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,...
|
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$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
| |