title: Cannot read Database or object read only
body: <p>I am trying to query an Excel file from another file using VBA and ADO options. When I run this code it's throwing the error "Cannot updata, Database or object Read only":</p>
  
  <pre><code>Public Function fnExecuteXlQuery _
      (ByVal strPath As String,  _
      ByVal strQuery As String) As ADODB.Recordset
  
  Dim rs As ADODB.Recordset
  Dim conStr As String
  
  On Error GoTo ErrorHandler
  
  conStr = "Provider=Microsoft.Jet.OLEDB.4.0; " _ 
        &amp; "Data Source=" &amp; strPath &amp; "; Extended Properties=Excel 8.0"
  
  Set rs = New ADODB.Recordset
  rs.Open strQuery, conStr, adOpenDynamic
  
  Set fnExecuteXlQuery = rs
  
  Exit Function
  ErrorHandler:
  Set fnExecuteXlQuery = Nothing
  fnDisplayError Error(Err) &amp; "Unable to fetch data from DTS...", ERROR_TYPE_ERROR
  End Function
  </code></pre>
  
  <p>The "<strong>strPath</strong>" is the source Excel file and the "<strong>strquery</strong>" has the following SQL code:</p>
  
  <pre><code>Select [Activity],[Name],[Date],[Hours Spent] 
  from [Time sheet$] 
  where [Activity] = 'Billable Activities' 
  Order by Name,date  
  </code></pre>