Hi Guys,
i prepared 2 ways of archiving my split database.
First: copy back end using:
Application.CompactRepair mehod
Second:
code like here:
Code:
Private Sub ButtonArchDaty_Click()
Dim oDB As dao.Database
Dim sFile As String
Dim NameString As String
Dim strString As String
DoCmd.SetWarnings False
If IsNull(Me.txtDateStart) Or IsNull(Me.txtDateEnd) Then
MsgBox "Nie wybrano prawidłowo przedziału dat"
End If
NameString = InputBox("Wpisz nazwę pliku", "Nazwa")
sFile = "C:\Users\ljar01\Desktop\Makro Braki Access\Nowy\Archiwum\" & NameString & ".accdb"
On Error Resume Next
Set oDB = DBEngine.Workspaces(0).CreateDatabase(sFile, dbLangGeneral)
If Err.Number <> 0 Then
MsgBox "Wybrany nazwa pliku już istnieje, wybierz inną"
End
End If
''DoCmd.CopyObject sFile, , acTable, "tbl_Braki"
strString = "SELECT [QryMakeBackUp].* INTO tbl_Braki IN " & "'" & sFile & "'" & " FROM [QryMakeBackUp]; "
DoCmd.RunSQL strString
DoCmd.SetWarnings True
MsgBox "Archiwizacja przebiegła pomyślnie"
''accessApp.DBEngine.CreateDatabase "D:\tblImport.accdb", DB_LANG_GENERAL
End Sub
So i am archivising query.
It is ok.
Now, please imagine the problem:
database is working 3 months or 0,5 year or year.
And it is very, very large.
I can do compact database but earlier or later - there will be a problem with database's size .
Now how to solve this - i am thinking of creating back-up files for for example 1 quarter, or half an year and delete records in my main back-end split database.
So user can choose dates and within query there will be a back up done. And now user should have possibility to open archive with specific dates (
i am assuming that user doesnt have to have possibility to change archive records, but if it is a good approach?)
thank you for all your tips,
Best Wishes,
Jacek Antek