How can I archive some of the data in my access database?
what is the best method of doing so.
Is there anyway I can include a command button on my switchboard that will archive data?
This can be modified to do what you want.
'Dim objects and variables
Dim objWord As Object
Dim strFile As String
Dim strSaveAsFile As String
'Grab the Document name strFile = "\\universal4\databases\RAD\Templates Assessment Forms\Temp For Work Equipment Risk Assessment.doc"
'Launch word
Set objWord = New Word.Application
With objWord
'Open the file
.Documents.Open FileName:=Chr(34) & strFile & Chr(34)
'Make it visible
.Visible = True
'Populate a bookmark
.ActiveDocument.Bookmarks.Item("Ref".Range.Text = " " & Me.[Assessment Refference Number] 'this is a textbox
.ActiveDocument.Bookmarks.Item("Ref1".Range.Text = " " & Me.[Combo58] 'this is a textbox
.ActiveDocument.Bookmarks.Item("Ref2".Range.Text = " " & Me.[Department] 'this is a textbox
.ActiveDocument.Bookmarks.Item("Ref3".Range.Text = " " & Me.[Combo14] 'this is a textbox
.ActiveDocument.Bookmarks.Item("Ref4".Range.Text = " " & Me.[Location] 'this is a textbox
.ActiveDocument.Bookmarks.Item("Ref5".Range.Text = " " & Me.[Assessment Date] 'this is a textbox
.Application.Options.PrintBackground = False
.ActiveDocument.PrintOut
Here's a strategy that I use in one of my applications:
Create a second MDB file with tables with identical structure as the tables that require archiving from the primary table.
Rename all the tables in the Archive database with "zArchive..." prefix -- to distinguish them from the originals
Link all the tables from the Archive into the same front end as the primary table
Write a form that allows the user to specify an archive criteria (e.g. records before a specified date)
Write a query that appends the selected records from the primary table into the corresponding Archive table
Write a second query that deletes the selected records from the primary table
Put all the commands onto a single command button.
My code is specific to my application, so it won't do you any good, but I hope you get the idea.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.