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

ACC-97 - Great Version Controller/Auto Incremental Backup

Based on MK's TSI_SOON (http://www.trigeminal.com/)I've created a
nifty little procedure that - whenever you compact you db you get an
incremental backup copy.
Given that you have a table with version information you get
incremental backups on a per-version basis.

SEE CODE BELOW

Basic idea is: start TSISOON with the options:
1. "compact this db"
2. Start second db ("AutoCopy.mdb")
3. Parameter for [Autocopy.mdb fnAutoCopy] is Currentdb.name +
currentversion

AutoCopy.mdb will do a filecopy(currentdb.mdb, currentdbV101_01.mdb)
next compact:
AutoCopy.mdb will do a filecopy(currentdb.mdb, currentdbV101_02.mdb)
next version first compact:
AutoCopy.mdb will do a filecopy(currentdb.mdb, currentdbV102_01.mdb)
etc.

AutoCopy.mdb will finish with a farewell call to TSISOON with option:
1. Start first db ("Currentdb.mdb")

And we're back in our currentdb, compacted and well with a
state-of-the-art copy
as bonus.

Only I encounter a small hickup during the farewell call to TSISOON:
an Invalid Pagefault in MSVBM60.DLL brings Access on its knees.

Your valued suggestions please.

Suggestion: you can put the code in the form_open proc of an empty
form; load the form from the tool/menubar.

'----------Code for Current.MDB start
Sub PoorMansVersionControl()
'************************************************* *******
' Purpose:
' ========
' Use this sub to Compact your db and create an incremental
' backup at the same time
'
' Prerequisites
' =============
' Prerequisites: your currentdb and an AutoCopy.mdb
'
' HowItWorks:
' ===========
' Prerequisites: your currentdb and an AutoCopy.mdb
' 1. Pass currentdb.name + currentversion to AutoCopy.mdb
' currentversion is in a table called "tblVersion"
' 2. Pass control to AutoCopy (Using TSISOON by MK)
' 3. AutoCopy.mdb will create incremental copy of currentdb
' (based on scanning the current dir for latest incremental copy)
' 4. AutoCopy.mdb passes control back to (read: opens) currentdb
'
' Remarks:
' ========
' The Currentdb holds a table (tblVersion) with version numbers:
' 1.00 initial version
' 1.01 adjusted layout frmOne
' Each time a compact is done; an incremental copy is also created
' Naming of the incremental backups is (suppose we're on version 1.01)
' CurrentdbV101_01.mdb
' CurrentdbV101_02.mdb
'
'************************************************* ****
' CreatedBy: Willem Pauw, oct 2003
'************************************************* *******
'
'
Dim rs As Recordset
Dim sCurrentDBName As String 'Long name: not 8.3 version
Dim sTableVersion As String
Dim vBackupRoot As Variant 'db-name + tableversion: CurretdbV101
'
'Get Current Versionnumber (1.12, 2.00 etc.)
'
Set rs = CurrentDb.OpenRecordset("SELECT * from tblVersie Order By
Versie desc")
sTableVersion = "V" & Left(rs!versie, 1) & Right(rs!versie, 2) '1.12,
2.01 etc
rs.Close
Set rs = Nothing
'
'Prepare Parameter to pass to AutoCopy.mdb
'
sCurrentDBName = fnLongCurrentDBName
vBackupRoot = Left(sCurrentDBName, Len(sCurrentDBName) - 4) &
sTableVersion

'
'Compact this DB and take a returntrip to AutoCopy.mdb
'
Dim tsd As Object
Set tsd = CreateObject("tsisoon90.connect80")
With tsd
.FileToOpen = "C:\@Projecten\AutoCopy.mdb"
.Exclusive = False
.CompactOld = True
.MakeMDE = False
.FunctionToRun = "fnAutoCopy"
.VariantFunctionArgument = vBackupRoot
.CloseAll Application
End With
Set tsd = Nothing

End Sub
Private Function fnLongCurrentDBName() As String

Dim sFirstLongNameInCurrentDir As String
Dim sShortNameOfCurrentDB As String
Dim sPathOfCurrentDB As String
Dim sTemp As String
Dim cTemp As String * 1
Dim i As Integer
'
' Get a random name in current directory
'
With Application.FileSearch
.NewSearch
.Filename = DBEngine(0)(0).Name
.MatchTextExactly = True
.Execute
sFirstLongNameInCurrentDir = .FoundFiles(1)
End With
Dim intCounter As Integer
'
' Get PathPart of found file
'
For i = Len(sFirstLongNameInCurrentDir) To 1 Step -1
If Mid$(sFirstLongNameInCurrentDir, i, 1) = "\" Then
Exit For
End If
Next i
sPathOfCurrentDB = Left$(sFirstLongNameInCurrentDir, i)
'
' Get DBname-part from currentdb
'
sShortNameOfCurrentDB = CurrentDb.Name
For i = Len(sShortNameOfCurrentDB) To 1 Step -1
cTemp = Mid$(sShortNameOfCurrentDB, i, 1)
If cTemp <> "\" Then
sTemp = cTemp & sTemp
Else
Exit For
End If
Next i
sShortNameOfCurrentDB = sTemp
'
'Let's glue it together
'
fnLongCurrentDBName = sPathOfCurrentDB & sShortNameOfCurrentDB

End Function
'----------Code for Current.MDB end
'----------Code for AUTOCOPY.MDB start
Public Function fnAutoCopy(vDatabasenamePlusTblVersion As Variant)
'************************************************* *******
' Purpose:
' ========
' Based on the passed Parameter this funcion will create
' in incremental copy.
'
' Example
' =======
' Parameter = "CurrentdbV102"
' Files already present: CurrentdbV101_01.mdb and CurrentdbV101_02.mdb
' File created this time: CurrentdbV101_03.mdb
'
' HowItWorks:
' ===========
' Prerequisites: your currentdb and an AutoCopy.mdb (this mdb)
' 1. Pass currentdb.name + currentversion to AutoCopy.mdb
' currentversion is in a table called "tblVersion"
' 2. Pass control to AutoCopy (Using TSISOON by MK)
' 3. AutoCopy.mdb will create incremental copy of currentdb
' (based on scanning the current dir for latest incremental copy)
' 4. AutoCopy.mdb passes control back to (read: opens) currentdb
'
' Remarks:
' ========
' The Currentdb holds a table (tblVersion) with version numbers:
' 1.00 initial version
' 1.01 adjusted layout frmOne
' Each time a compact is done; an incremental copy is also created
' Naming of the incremental backups is (suppose we're on version 1.01)
' CurrentdbV101_01.mdb
' CurrentdbV101_02.mdb
'
'************************************************* ****
' CreatedBy: Willem Pauw, oct 2003
'************************************************* *******
Dim sBackupRoot As String
Dim sDIR As String
Dim iVersionNumberOld As Integer
Dim iVersionNumberCurrent As Integer
Dim iVersionNumberHighest As Integer
Dim sBackupSource As String
Dim sBackupTarget As String
'
'Check for latest backup
'
sBackupRoot = vDatabasenamePlusTblVersion & "_"
sDIR = Dir(sBackupRoot)
'
'Get the latest version
'
Do While Not sDIR = ""
'
'Check highest version
'
iVersionNumberCurrent = Left(Right(sDIR, 6), 2) '.... _01.mdb ...
_02.mdb etc
If iVersionNumberCurrent > iVersionNumberOld Then
iVersionNumberHighest = iVersionNumberCurrent
End If
iVersionNumberCurrent = iVersionNumberOld
'
sDIR = Dir()
Loop
'
'Create backupcopy with new versionnumber
'
sBackupTarget = sBackupRoot & "_" & Right("0" & iVersionNumberHighest
+ 1, 2) & ".mdb"
sBackupSource = Left(sBackupRoot, Len(sBackupRoot) - 5) & ".mdb"

FileCopy Source:=sBackupSource, destination:=sBackupTarget
'
'Now jump back to calling db
'
Dim tsd As Object
Stop

Set tsd = CreateObject("tsisoon90.connect80")
With tsd
.FileToOpen = sBackupSource
.Exclusive = False
.CompactOld = False
.MakeMDE = False
.CloseAll Application
End With
Set tsd = Nothing

End Function
'----------Code for AUTOCOPY.MDB end
Nov 12 '05 #1
0 3109

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Sheer | last post by:
I have managed to build Python 2.3.3 with the aCC HP-UX C++ compiler by making a number of one-line changes. (For reasons beyond my control, I am forced to use this compiler and it has no C mode...
4
by: rpmohan | last post by:
Hello, I have sample Program called sample.C . The source code looks like below. #include <List.h> int main(int argc, char *argv) { List<int> myList; return 0;
4
by: zzfreddybb | last post by:
We are using HP aCC compiler on a HP Itanium box ( 11.23) We are having some severe performance hits using exception handling ( try/catch ) scenarios. The online aCC documentation says: HP...
0
by: mbpradeep | last post by:
Hello all, I am compiling a C++ application with aCC (LP64 model - +DD64). But we are using some non standard includes like (/opt/aCC/include/SC - standard components) Time.h (note capital "T")...
10
by: vd12005 | last post by:
hello, i'm wondering how people from here handle this, as i often encounter something like: acc = # accumulator ;) for line in fileinput.input(): if condition(line): if acc: #1...
0
by: musathiyan | last post by:
Hello, I am trying to port a code module from CC compiler to aCC compiler. This raises the following errors: Error 173: "/opt/aCC/include_std/limits", line 694 # Redefined symbol ...
5
by: Mike | last post by:
Hi, We are pleased to announce the release of AspeCt-oriented C (ACC) V 0.6. The ACC 0.6 release includes some experimental features and a new script "tacc" for automatically integrating...
0
by: Mike | last post by:
We are pleased to announce the release of AspeCt-oriented C (ACC) V 0.7. The ACC 0.7 release includes two main experimental features: The variable set() and get() pointcut. For more details...
1
by: nsarkar | last post by:
Hello Friends, We are using HPU (B.11.23 U 9000/800 908196403), and aCC (HP ANSI C++ B3910B A.03.70), and it is regarding a warning we got at the time of compiling our C++ Application. ...
0
by: Z | last post by:
We have a bunch of access add-ins that we created in acc 2000. Trying to upgrade to acc 2007 but we can't seem to get the add-ins to work. Is there a equivalent to the USYSREGINFO? We can't...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.