Skip to content

Commit

Permalink
Check default open mode before install
Browse files Browse the repository at this point in the history
Users may encounter problems installing the add-in if they have configured Microsoft Access to open databases in exclusive mode by default. This update checks the current option, and offers to update it before attempting the install. Closes #68
  • Loading branch information
joyfullservice committed Oct 19, 2020
1 parent 040b5d2 commit 5a08277
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Version Control.accda.src/modules/modAddIn.bas
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ End Function
'---------------------------------------------------------------------------------------
' Procedure : InstallVCSAddin
' Author : Adam Waller
' Date : 1/14/2020
' Date : 10/19/2020
' Purpose : Installs/updates the add-in for the current user.
' : Returns true if successful.
'---------------------------------------------------------------------------------------
'
Private Function InstallVCSAddin() As Boolean

Const OPEN_MODE_OPTION As String = "Default Open Mode for Databases"

Dim strSource As String
Dim strDest As String

Expand All @@ -135,6 +137,19 @@ Private Function InstallVCSAddin() As Boolean
' We can't replace a file with itself. :-)
If strSource = strDest Then Exit Function

' Check default database open mode.
If Application.GetOption(OPEN_MODE_OPTION) = 1 Then
If MsgBox2("Default Open Mode set to Exclusive", _
"The default open mode option for Microsoft Access is currently set to open databases in Exclusive mode by default. " & vbCrLf & _
"This add-in needs to be opened in shared mode in order to install successfully.", _
"Change the default open mode to 'Shared'?", vbYesNo + vbExclamation) = vbYes Then
Application.SetOption OPEN_MODE_OPTION, 0
MsgBox2 "Default Option Changed", _
"Please restart Microsoft Access and run the install again.", , vbInformation
End If
Exit Function
End If

' Copy the file, overwriting any existing file.
' Requires FSO to copy open database files. (VBA.FileCopy give a permission denied error.)
' We also use FSO to force the deletion of the existing file, if found.
Expand Down

0 comments on commit 5a08277

Please sign in to comment.