Mike Eghtebas
asked on
Error 80040e21... rs.Open "SELECT ...
Dim cn As ADODB.Connection
dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
cn.Open "DRIVER={Microsoft Excel Driver (*.xls)};DriverId=790;Read Only=True; " & "DBQ=" & "c:\book1.xls" & ";"
Set rs = New ADODB.Recordset
'**** Following line errors: ODBC driver does not support the requested properties*****
rs.Open "SELECT * FROM [SHEET1]", cn, adOpenForwardOnly, adLockReadOnly, adCmdText
While Not rs.EOF
MsgBox rs(0)
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
Why am I getting this error?
dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
cn.Open "DRIVER={Microsoft Excel Driver (*.xls)};DriverId=790;Read
Set rs = New ADODB.Recordset
'**** Following line errors: ODBC driver does not support the requested properties*****
rs.Open "SELECT * FROM [SHEET1]", cn, adOpenForwardOnly, adLockReadOnly, adCmdText
While Not rs.EOF
MsgBox rs(0)
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
Why am I getting this error?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
rs.Open "SELECT * FROM [SHEET1]", cn, 3, 2
TRy this instead
TRy this instead
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Please see https://www.experts-exchange.com/questions/21188127/Help-to-write-in-closed-xls-file-using-ADODB-vb6.html for a new followup question.
Thanks.
Thanks.
ASKER
Mike