Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error 80040e21... rs.Open "SELECT ...

Posted on 2004-10-27
6
Medium Priority
?
1,629 Views
Last Modified: 2008-01-09
Dim cn As ADODB.Connection
dim rs As ADODB.Recordset

Set cn = New ADODB.Connection
    cn.Open "DRIVER={Microsoft Excel Driver (*.xls)};DriverId=790;ReadOnly=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?
0
Comment
Question by:Mike Eghtebas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 12427317
Well, $ was missing from worksheet name.  I didn't think it is mandatory to have it there.

Mike
0
 
LVL 14

Accepted Solution

by:
aelatik earned 1200 total points
ID: 12427383
You can find more info here on select statements for Excel sheets like selecting within CELL range's etc.

http://support.microsoft.com/kb/257819/EN-US/
0
 
LVL 3

Assisted Solution

by:Egore
Egore earned 400 total points
ID: 12427419
You may want to look at this newsgroup thread (particularly the last two posts):

http://groups.google.com/groups?hl=en&lr=&safe=off&th=7f28c50074fcaeb2&seekm=3d65a4c9%241%40dnews.tpgi.com.au&frame=off

I'm not certain if that URL is permanent, but hopefully it is...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 48

Expert Comment

by:Mikal613
ID: 12427437
rs.Open "SELECT * FROM [SHEET1]", cn, 3, 2

TRy this instead
0
 
LVL 48

Assisted Solution

by:Mikal613
Mikal613 earned 400 total points
ID: 12427454
rs.Open "SELECT * FROM [SHEET1$]", cn, 3, 2

I mean this sorry!
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 12447440
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question