TRY SELECT (m.tvWorkarea) Local loConn as ADODB.Connection, loRS as ADODB.Recordset, loCursor as CursorAdapter loConn = CreateObject("ADODB.Connection") loConn.ConnectionString = [Provider=Microsoft.ACE.OLEDB.12.0;Data Source="] + m.tcXLSFile + [";Extended Properties="Excel 12.0;HDR=] + m.lcHeaderRow + [;";] =CURSORSETPROP("FetchMemo",.t.,0) try loConn.Open() If loConn.State = 1 && connection open loRS = CreateObject("ADODB.Recordset") loRS.ActiveConnection = loConn loCursor = CreateObject("CursorAdapter") loCursor.Alias = m.lcSQLAlias loCursor.DataSourceType = "ADO" loCursor.DataSource = loRS loCursor.FetchMemo = .t. loCursor.SelectCmd = "SELECT " + m.tcExcelFieldList + " FROM [" + m.tcSheet + "] Where " + m.tcExcelWhereExpr lnSQL = 0 If !loCursor.CursorFill() lnSQL = - 1 aerror(laErr) *ERROR m.laErr[2] oAppObj.write_log('ADODB Connection CursorFill method resulted in error for ' + m.tcXLSFile + ' sheet ' + m.tcSheet + CHR(13) + ; 'Error message is: ' + m.laErr[2], PROGRAM(),'E') EndIf ELSE lnSQL = - 1 oAppObj.write_log('ADODB Connection can not be opened for ' + m.tcXLSFile + ' sheet ' + m.tcSheet + CHR(13) + ; 'Error message is: ' + m.laErr[2], PROGRAM(),'E') EndIf CATCH TO loException lnSQL = - 1 oAppObj.write_log('ADODB Connection can not be opened for ' + m.tcXLSFile + ' sheet ' + m.tcSheet + CHR(13) + ; 'Error message is: ' + loException.Message, PROGRAM(),'E') endtry if m.lnSQL < 0 lnSQL = sqlstringconnect([Provider=Microsoft.ACE.OLEDB.12.0;Data Source="] + m.tcXLSFile + [";Extended Properties="Excel 8.0;HDR=] + m.lcHeaderRow + [;";]) *!* Alternate using DSN that comes with Office install (MSDASQL = OLEDB wrapper for ODBC) *!* m.lnSQL = SQLSTRINGCONNECT("Provider=MSDASQL.1;" ; *!* +"Persist Security Info=False;" ; *!* +"DSN=Excel Files;" ; *!* +"DBQ="+FULLPATH(m.tcXLSFile)+";" ; *!* +"DriverId=790;" ; *!* +"MaxBufferSize=2048;" ; *!* +"PageTimeout=5;") *!* Try a few other drivers that may be on the user's machine if m.lnSQL < 0 aerror(laErr) oAppObj.write_log('Connection with Provider=Microsoft.ACE.OLEDB.12.0 is failing for ' + m.tcXLSFile + ' sheet ' + m.tcSheet + chr(13) + ; 'Error message is: ' + m.laErr[2], program(),'E') lnSQL = sqlstringconnect("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};" ; + "DBQ="+fullpath(m.tcXLSFile)+";") if m.lnSQL < 0 and upper(alltrim(justext(m.tcXLSFile))) == "XLS" && can we try using the older driver? aerror(laErr) oAppObj.write_log('Connection with Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)} is failing for ' + m.tcXLSFile + ' sheet ' + m.tcSheet + chr(13) + ; 'Error message is: ' + m.laErr[2], program(),'E') if m.lnSQL < 0 lnSQL = sqlstringconnect("Driver={Microsoft Excel Driver (*.xls)};" ; + "DBQ="+fullpath(m.tcXLSFile)+";") endif endif if m.lnSQL < 0 aerror(m.laErr) oAppObj.write_log('Connection with old Driver={Microsoft Excel Driver (*.xls)} is failing for ' + m.tcXLSFile + ' sheet ' + m.tcSheet + chr(13) + ; 'Error message is: ' + m.laErr[1,2], program(),'E') error m.laErr[2] endif endif endif