473,246 Members | 1,480 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,246 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 3099

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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.