Skip to content

Commit

Permalink
Compile and save VBE modules after importing
Browse files Browse the repository at this point in the history
Modules need to be saved before other properties can be added, such as custom descriptions and hidden attributes. Fixes #236
  • Loading branch information
joyfullservice committed Jun 8, 2021
1 parent 0137772 commit 86e2b41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 25 deletions.
12 changes: 9 additions & 3 deletions Version Control.accda.src/modules/modImportExport.bas
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,18 @@ Public Sub Build(strSourceFolder As String, blnFullBuild As Boolean)
' Show category wrap-up.
Log.Add "[" & colFiles.Count & "]" & IIf(Options.ShowDebug, " " & LCase(cCategory.Category) & " processed.", vbNullString)
Perf.ComponentEnd colFiles.Count

' After importing modules, we need to save them before adding
' other properties like descriptions or hidden attributes
If cCategory.ComponentType = edbModule Then
Perf.OperationStart "Compile/Save Modules"
DoCmd.RunCommand acCmdCompileAndSaveAllModules
DoEvents
Perf.OperationEnd
End If
End If
Next cCategory

' Compile and save the modules after importing as VBE Components
CompileAndSaveAllModules

' Run any post-build/merge instructions
If blnFullBuild Then
If Options.RunAfterBuild <> vbNullString Then
Expand Down
23 changes: 1 addition & 22 deletions Version Control.accda.src/modules/modVCSUtility.bas
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ Public Function GetAllContainers() As Collection
' Additional objects to import after ADP/MDB specific items
.Add New clsDbForm
.Add New clsDbMacro
.Add New clsDbModule
.Add New clsDbReport
.Add New clsDbTableData
.Add New clsDbModule
If blnMDB Then
.Add New clsDbTableDataMacro
.Add New clsDbRelation
Expand Down Expand Up @@ -561,24 +561,3 @@ Public Sub ClearOrphanedSourceFiles(cType As IDbComponent, ParamArray StrExtensi

End Sub


'---------------------------------------------------------------------------------------
' Procedure : CompileAndSaveAllModules
' Author : Adam Waller
' Date : 5/26/2021
' Purpose : Run the command to compile and save all modules in the currentproject.
' : NOTE: It is very important that you do not run this in the codeproject
' : or you may crash Access.
'---------------------------------------------------------------------------------------
'
Public Sub CompileAndSaveAllModules()
If GetVBProjectForCurrentDB.FileName <> VBE.ActiveVBProject.FileName Then
' Make sure the active project is set to the current project so we compile
' and save the current project, not the add-in.
Set VBE.ActiveVBProject = GetVBProjectForCurrentDB
End If
Perf.OperationStart "Compile/Save Modules"
DoCmd.RunCommand acCmdCompileAndSaveAllModules
DoEvents
Perf.OperationEnd
End Sub

0 comments on commit 86e2b41

Please sign in to comment.