Skip to content

Commit 86e2b41

Browse files
Compile and save VBE modules after importing
Modules need to be saved before other properties can be added, such as custom descriptions and hidden attributes. Fixes #236
1 parent 0137772 commit 86e2b41

File tree

2 files changed

+10
-25
lines changed

2 files changed

+10
-25
lines changed

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

+9-3
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,18 @@ Public Sub Build(strSourceFolder As String, blnFullBuild As Boolean)
366366
' Show category wrap-up.
367367
Log.Add "[" & colFiles.Count & "]" & IIf(Options.ShowDebug, " " & LCase(cCategory.Category) & " processed.", vbNullString)
368368
Perf.ComponentEnd colFiles.Count
369+
370+
' After importing modules, we need to save them before adding
371+
' other properties like descriptions or hidden attributes
372+
If cCategory.ComponentType = edbModule Then
373+
Perf.OperationStart "Compile/Save Modules"
374+
DoCmd.RunCommand acCmdCompileAndSaveAllModules
375+
DoEvents
376+
Perf.OperationEnd
377+
End If
369378
End If
370379
Next cCategory
371380

372-
' Compile and save the modules after importing as VBE Components
373-
CompileAndSaveAllModules
374-
375381
' Run any post-build/merge instructions
376382
If blnFullBuild Then
377383
If Options.RunAfterBuild <> vbNullString Then

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

+1-22
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ Public Function GetAllContainers() As Collection
5656
' Additional objects to import after ADP/MDB specific items
5757
.Add New clsDbForm
5858
.Add New clsDbMacro
59-
.Add New clsDbModule
6059
.Add New clsDbReport
6160
.Add New clsDbTableData
61+
.Add New clsDbModule
6262
If blnMDB Then
6363
.Add New clsDbTableDataMacro
6464
.Add New clsDbRelation
@@ -561,24 +561,3 @@ Public Sub ClearOrphanedSourceFiles(cType As IDbComponent, ParamArray StrExtensi
561561

562562
End Sub
563563

564-
565-
'---------------------------------------------------------------------------------------
566-
' Procedure : CompileAndSaveAllModules
567-
' Author : Adam Waller
568-
' Date : 5/26/2021
569-
' Purpose : Run the command to compile and save all modules in the currentproject.
570-
' : NOTE: It is very important that you do not run this in the codeproject
571-
' : or you may crash Access.
572-
'---------------------------------------------------------------------------------------
573-
'
574-
Public Sub CompileAndSaveAllModules()
575-
If GetVBProjectForCurrentDB.FileName <> VBE.ActiveVBProject.FileName Then
576-
' Make sure the active project is set to the current project so we compile
577-
' and save the current project, not the add-in.
578-
Set VBE.ActiveVBProject = GetVBProjectForCurrentDB
579-
End If
580-
Perf.OperationStart "Compile/Save Modules"
581-
DoCmd.RunCommand acCmdCompileAndSaveAllModules
582-
DoEvents
583-
Perf.OperationEnd
584-
End Sub

0 commit comments

Comments
 (0)