Skip to content

Commit

Permalink
Test to determine if procedure exists
Browse files Browse the repository at this point in the history
Using another WizHook function to see if a procedure exists before attempting to run it in the current database.
  • Loading branch information
joyfullservice committed Mar 10, 2023
1 parent 25668d4 commit 802b71b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Version Control.accda.src/modules/modDatabase.bas
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,13 @@ Public Sub RunSubInCurrentProject(strSubName As String)
Exit Sub
End If

' Make sure procedure exists in current database
If Not GlobalProcExists(strSubName) Then
Log.Error eelError, "The procedure """ & strSubName & """ not found.", ModuleName & ".RunSubInCurrentProject"
Log.Add "The procedure must be declared as public in a standard module.", False
Exit Sub
End If

' Add project name so we can run it from the current datbase
strCmd = "[" & CurrentVBProject.Name & "]." & strCmd

Expand Down
13 changes: 13 additions & 0 deletions Version Control.accda.src/modules/modWizHook.bas
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ Public Function CurrentVBProject() As VBProject
End Function


'---------------------------------------------------------------------------------------
' Procedure : GlobalProcExists
' Author : Adam Waller
' Date : 3/10/2023
' Purpose : Returns true if the procedure exists (Public proc in standard module)
'---------------------------------------------------------------------------------------
'
Public Function GlobalProcExists(strName) As Boolean
CheckKey
GlobalProcExists = WizHook.GlobalProcExists(strName)
End Function


'---------------------------------------------------------------------------------------
' Procedure : CheckKey
' Author : Adam Waller
Expand Down

0 comments on commit 802b71b

Please sign in to comment.