Yesterday, I explained that the Access JumpStart system Steve Halder and I developed as a framework to use for our Access database clients has a nice little feature that allows you to set a whole set of global options and then define overrides for those options based on different environments. And it does this by allowing you to set the table it will use at run time for overrides.
I have finished the script after writing yesterday’s article, so that step ended up being preceded by two other steps.
Another feature of AJS is that it has a function to run after importing new code files from my versioning system. This function uses TortoiseSVN to read the current repository revision number that I can then use in the product’s version number.
So now the first step in the process is to run this function. I don’t have to do anything else, it will pick up the latest revision number that I have committed and update all the necessary tables, modules, and functions that need to be updated.
' Step 1 - Udpate the version number based on latest committed value
AJS_APPupdateVersionNumber
Now that the version number has been burned into the Access file, we are ready to copy this file and start modifying it further to get it ready for deployment. So with the following Code, I am defining where my deployment file will go, checking to make sure the folder exists and if not, create it, then delete any old file that might be there. Technically, the copy command can overwrite the old file which technically does the same thing, but I like to do it explicitly so there is no question.
' Step 2 - Create a copy of myself in the Current Project's MakeLive folder
Dim FileSystem As Object
Dim LiveFilePath As String
Set FileSystem = CreateObject("Scripting.FileSystemObject")
LiveFilePath = CurrentProject.Path & "\MakeLive\" & CurrentProject.Name
If Not HALFile.FolderExists(CurrentProject.Path & "\MakeLive") Then HALFile.CreatePath CurrentProject.Path & "\MakeLive"
If HALFile.FileExists(LiveFilePath) Then Kill LiveFilePath
FileSystem.CopyFile CurrentProject.FullName, LiveFilePath
My third step is the same that we worked on yesterday, which updates the override table name in the new file.
' Step 3 - Then we will need to set a reference to that database and update
' the table in that database to be set for the live system.
Dim dbLive As DAO.Database
Set dbLive = DAO.OpenDatabase(LiveFilePath)
Dim LiveOptionTable As String: LiveOptionTable = "tblAJS_OO_Live"
dbLive.Execute "UPDATE tblAJSoptions SET OptValue='" & LiveOptionTable & "' WHERE OptName='AJS_ProdOverride'"
The next set of steps will be to:
Step 4: Make sure the database properties in the live database are set correcly.
Step 5: Delete temp table data.
Step 6: Remove VBA references used for development and update compiler constants to do late binding
Step 7: Compact, Decompile, then Compact again.
I will go more in depth with that code and the helper functions that they use tomorrow.