Access JumpStart 2.0 | Blog

A Rapid Development Framework for Microsoft Access

Today I was considering how best to setup automated upgrades for a customer for when I deploy a new version of their Access suite.

I say suite because it is together about 9 Access programs that all get installed using an install file that I create using SSE Install which I’ve mentioned in the past. This is a fantastic installer program with additional features for Access developers.

In any case, I create setup files which are signed using my electronic key and are trusted when sent, all using SSE Install. Each setup file has a “File Version” and a “Product Version” assigned as file properties. These properties both equate to the newest version number that is set in my Access App Launcher.

So I need routines in each of the Access apps in the suite to check the version of their related app launcher and then check the file version number of the latest install file to see if it is a newer version.

Ultimately, then I need to shutdown Access and run the installer file. I would like to store a file or db table in the launcher app that will store processes for any open applications so that my shutdown script will be able to attempt to find and stop all databases in the system before running the upgrade installer.

Whew! So challenge number one was to be able to read the custom file properties set up by the SSE installer.

Here’s the function I ended up with after some playing around:

Public Function GetFilePropertyByName(FullyQualifiedFile As String,PropertyName As String) As String 
    Dim objShell  As Object  'Shell
    Dim objFolder As Object  'Folder
    Dim szItem As Variant,varFP As Variant,varFN As Variant 
    varFP = GetPathPartFromPath(FullyQualifiedFile) 
    varFN = GetFilenameFromPath(FullyQualifiedFile) 
    Dim i As Integer 
    
    Set objShell = CreateObject( "Shell.Application") 
    Set objFolder = objShell.Namespace(varFP) 
    
    If (Not objFolder Is Nothing) Then 
    Dim objFolderItem As Object  'FolderItem
    Set objFolderItem = objFolder.ParseName(varFN) 
    For i = 0 To 1000 
        If objFolder.GetDetailsOf(Nothing,i) = PropertyName Then Exit For 
    Next 
    szItem = objFolder.GetDetailsOf(objFolderItem,i) 
    'If CStr(szItem) <> "" Then Debug.Print i & " - " & PropertyName & " : " & szItem
    Set objFolderItem = Nothing 
    End If 
    
    Set objFolder = Nothing 
    Set objShell = Nothing 
    GetFilePropertyByName = szItem 
End Function 

This will take a file and search for a property name of the file by string.

Different files can have different properties, sometimes with the same names but in different order. The full list of properties seem to be built by the folder code, so each folder seems to have a completely different set of properties available and the properties themselves can change in order if you move the same file to another computer or even another folder.