Option 2 won't work. OLEDB is not the same as ODBC. You can't use an OLEDB provider that way.
>Could anybody see why the following two ways of using Access Jet driver give me different results:
>
>1. I get no problem and no error when I create ADODB connection object using the following connection string and the
>following code:
>
>
>cConnString = 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=' + m.tcXLSFile + ';
> Extended Properties="Excel 12.0;HDR=' + m.lcHeaderRow + '"'
>
>Local oConn As 'ADODB.Connection'
> Local oRS As ADODB.RecordSet
> oConn = Createobject('ADODB.Connection')
> oConn.Mode= 1
> oConn.Open(cConnString )
> oRS = oConn.Execute(m.tcQuery)
>
>
>
>2. But when I try to connect to the same Excel spreadsheet file using SQLSTRINGCONNECT() I get a pop-up window that prompts me to select/enter a DSN file:
>
>
>cConnString = 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=' + m.tcXLSFile + ';
>Extended Properties="Excel 12.0;HDR=' + m.lcHeaderRow + '"'
>
>m.lnSQL = SQLSTRINGCONNECT(cConnString)
>
>
>As you can see above that the connecting string is the same but the second case is not working.
>
>TIA.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer