Skip to content

Commit 932e04b

Browse files
Compile and save correct VBE project
If we don't specify the active project, we might be compiling and saving the add-in instead of the current database. This can cause the modules not to be listed as Access objects, causing further issues in the build process. This was a major breakthrough in resolving #236
1 parent 7d7f9c2 commit 932e04b

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

Version Control.accda.src/modules/modImportExport.bas

+6-4
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ Public Sub Build(strSourceFolder As String, blnFullBuild As Boolean)
192192
Dim colFiles As Collection
193193
Dim varFile As Variant
194194
Dim strType As String
195+
Dim blnCompiled As Boolean
195196

196197
Dim strText As String ' Remove later
197198

@@ -370,14 +371,15 @@ Public Sub Build(strSourceFolder As String, blnFullBuild As Boolean)
370371
' After importing modules, we need to save them before adding
371372
' other properties like descriptions or hidden attributes
372373
If cCategory.ComponentType = edbModule Then
373-
Perf.OperationStart "Compile/Save Modules"
374-
DoCmd.RunCommand acCmdCompileAndSaveAllModules
375-
DoEvents
376-
Perf.OperationEnd
374+
CompileAndSaveAllModules
375+
blnCompiled = True
377376
End If
378377
End If
379378
Next cCategory
380379

380+
' Ensure that we have compiled and saved all VBE modules
381+
If Not blnCompiled Then CompileAndSaveAllModules
382+
381383
' Initialize forms to ensure that the colors/themes are rendered properly
382384
' (This must be done after all objects are imported, since subforms/subreports
383385
' may be involved, and must already exist in the database.)

Version Control.accda.src/modules/modVCSUtility.bas

+17
Original file line numberDiff line numberDiff line change
@@ -561,3 +561,20 @@ Public Sub ClearOrphanedSourceFiles(cType As IDbComponent, ParamArray StrExtensi
561561

562562
End Sub
563563

564+
565+
'---------------------------------------------------------------------------------------
566+
' Procedure : CompileAndSaveAllModules
567+
' Author : Adam Waller
568+
' Date : 7/10/2021
569+
' Purpose : Compile and save the modules in the current database
570+
'---------------------------------------------------------------------------------------
571+
'
572+
Public Sub CompileAndSaveAllModules()
573+
Perf.OperationStart "Compile/Save Modules"
574+
' Make sure we are running this in the CurrentDB, not the CodeDB
575+
Set VBE.ActiveVBProject = GetVBProjectForCurrentDB
576+
DoCmd.RunCommand acCmdCompileAndSaveAllModules
577+
DoEvents
578+
Perf.OperationEnd
579+
End Sub
580+

0 commit comments

Comments
 (0)