Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Archiving Access Data 3

Status
Not open for further replies.

matpj

Technical User
Mar 28, 2001
687
GB
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?

thanks for any help,
Matthew
 
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



strSaveAsFile = Chr(34) & "\\universal4\databases\RAD\Assessments\" & Me.[Assessment Refference Number] & Chr(34)
.ActiveDocument.SaveAs FileName:=strSaveAsFile
.Quit


End With
Set objWord = Nothing
End Sub
Regards Andy :-9
It needs working to your form but it works for me.
Vote for me if you find this advice helpful
 
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.
 
jacksonmacd,

thankyou for your suggestion, I will try and work with it.
Could you tell me how to write the form that allows the user to specify a date?

also, I am not sure on the whole 'query' side of things, i.e how do I tell it to append and then delete data?

thanks for your help
 
Can anyone help me with my last comment (above)
its gettingurgent now (deadlines and everything) and I dont have a clue!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top