title: Launch password protected database and close existing one
body: <p>I am trying to set up a &quot;Launcher&quot; database which contains VBA code that will open a second database which is password protected. I can then convert the launcher db to accde so the VBA containing the password cannot be read.</p>
  <p>I have the following code so far.</p>
  <pre class="lang-vb prettyprint-override"><code>Private Sub Form_Load()
   Dim acc As Access.Application
   Dim db As DAO.Database
   Dim strDbName As String
  
   strDbName = &quot;C:\database Folder\secureDB.accdb&quot;
   Set acc = New Access.Application
   acc.Visible = True
   Set db = acc.DBEngine.OpenDatabase(strDbName, False, False, &quot;;PWD=swordfish&quot;)
  
   acc.OpenCurrentDatabase (strDbName)
   
   Application.Quit
    
  End Sub
  </code></pre>
  <p>When the launcher db is opened a form loads which subsequently fires the above code. It works but the problem is the last line which is intended to close the launcher db only but closes both databases. I have also tried opening the main database using Shell but am unable to pass the password this way.</p>
  <p>How can I close the first database while keeping the second open?</p>