diff --git a/access-add-in/source/modules/AddInConfiguration.cls b/access-add-in/source/modules/AddInConfiguration.cls
index b0eebf6..a590629 100644
--- a/access-add-in/source/modules/AddInConfiguration.cls
+++ b/access-add-in/source/modules/AddInConfiguration.cls
@@ -31,6 +31,7 @@ Option Explicit
' Procedure run in the installed add-in file before it is used/compiled (e.g. to set references)
Private Const DbPropertyNamePrepareProcedure As String = "AddInPrepareProcedure"
+Private Const ErrNumberItemNotFound As Long = 3265
Private m_AppTitle As String
Private m_Title As String
@@ -249,6 +250,7 @@ Private Sub SaveDataToDatabase()
Set db = CurrentDb
SetDbProperty db, "AppTitle", m_AppTitle
+ SavePrepareProcedure db
SetDocProperty db, "Title", m_Title
SetDocProperty db, "Author", m_Author
@@ -257,6 +259,35 @@ Private Sub SaveDataToDatabase()
End Sub
+' DAO cannot create a text property with an empty value, so an empty value removes the property
+Private Sub SavePrepareProcedure(ByVal PropDb As DAO.Database)
+
+ If Len(m_PrepareProcedure) > 0 Then
+ SetDbProperty PropDb, DbPropertyNamePrepareProcedure, m_PrepareProcedure
+ Else
+ RemoveDbProperty PropDb, DbPropertyNamePrepareProcedure
+ End If
+
+End Sub
+
+Private Sub RemoveDbProperty(ByVal PropDb As DAO.Database, ByVal PropertyName As String)
+
+On Error GoTo HandleErr
+
+ PropDb.Properties.Delete PropertyName
+
+ExitHere:
+ Exit Sub
+
+HandleErr:
+ If Err.Number = ErrNumberItemNotFound Then
+ Resume ExitHere
+ End If
+
+ Err.Raise Err.Number, "AddInConfiguration.RemoveDbProperty->" & Err.Source, Err.Description
+
+End Sub
+
Private Sub SetDbProperty(ByVal PropDb As DAO.Database, PropertyName As String, ByVal NewValue As Variant)
On Error GoTo HandleErr
diff --git a/access-add-in/source/modules/_config_Application.bas b/access-add-in/source/modules/_config_Application.bas
index e64da0a..b369e42 100644
--- a/access-add-in/source/modules/_config_Application.bas
+++ b/access-add-in/source/modules/_config_Application.bas
@@ -11,6 +11,7 @@
'
'
'
+'
'
'---------------------------------------------------------------------------------------
'
@@ -29,6 +30,9 @@ Public Const ACCUNIT_DLL_FILE As String = "AccUnit.dll"
Private Const APPLICATION_STARTFORMNAME As String = "AccUnitLoaderForm"
+' Run by the add-in installer in the installed add-in file (sets the AccUnit.tlb reference)
+Private Const ADDIN_PREPARE_PROCEDURE As String = "CheckAccUnitTypeLibFile"
+
Private m_Extensions As Object 'ApplicationHandler_ExtensionCollection
'---------------------------------------------------------------------------------------
@@ -110,6 +114,15 @@ End Sub
'
'End Sub
+' Sets the database property AddInPrepareProcedure manually (run with F5 in the VBE)
+Private Sub SetAddInPrepareProcedure()
+ With New AddInConfiguration
+ .LoadFromCurrentFile
+ .PrepareProcedure = ADDIN_PREPARE_PROCEDURE
+ .SaveToCurrentFile
+ End With
+End Sub
+
Public Sub PrepareForVCS()
If DaoTools.TableDefExists("ACLib_ConfigTable") Then
Application.CurrentDb.TableDefs.Delete "ACLib_ConfigTable"