title: VBA runtime error: could not find file
body: <p>Good day all. I have a problem that I simply cannot seem to solve. I am working on an excel program that retrieve data from and update an MS Access 2010 db. I am connecting with the db using ADODB.Connection  and the file (access.accdb) resides in a file server. When the application first launches it uses form1 to get logon details from the user and checks if the user id exists within the db. This function resides within a module and works fine. When I attempt to open the same file from a sub within another user form (form2) I keep getting an error that the file could not be found. I am using the exact same path string as what is used within the module only that this time it is used from within a user form. Below is the code within Module2:</p>
  
  <pre><code>Dim con As Object
  Dim rs As Object
  Dim path As String
  path = "path.accdb"
  Set con = CreateObject("ADODB.Connection")
  Set rs = CreateObject("ADODB.Recordset")
  with con
  .Provider = "Microsoft.ACE.OLEDB.12.0"
  .ConnectionString = "Data Source = " &amp; path &amp; "; Jet OLEDB:Database Password = pwd"
  .Open
  </code></pre>
  
  <p>This works fine.
  I use the same only from a user form and without the recordset object. I am not retrieving data from the form but rather updating the db. The form is used for data capturing only.</p>
  
  <p>Any help will be appreciated. Thanks.</p>
  
  <p>This is the code that I am using within form1:</p>
  
  <pre><code>Dim conn As Object
  Dim strPath As String
  strPath = "path.accdb" 'same as the path I used from within Module2
  Set conn = CreateObject("ADODB.Connection")
  with conn
  .Provider = "Microsoft.ACE.OLEDB.12.0"
  .ConnectionString = "Data Source = " &amp; strPath &amp; "; Jet OLEDB:Database Password = pwd"
  .Open    'this is where I get the error.
  'Rest of code
  </code></pre>
  
  <p>Error message:
  Run-time-error '-2147467259 (80004005)':
  Could not find file 'path.accdb'</p>
  
  <p>I have checked the path and it is correct. I have checked for missing references. I must also mention that the database file is located on a folder on my company folder to which I do have access.</p>