Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ado openschema not working?

264 views
Skip to first unread message

ljb

unread,
May 5, 2004, 11:18:36 AM5/5/04
to
Why does this code in a vbs file not work? OpenSchema always produces
"Object or provider is not capable of performing requested operation"

Set con = CreateObject("ADODB.Connection.2.7")
con.open "Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Status.mdb;"
Set rst = con.OpenSchema(adSchemaViews)

While the following code pasted in an Access module of the same database
works everytime.

Dim rst As ADODB.Recordset
Set rst = CurrentProject.Connection.OpenSchema(adSchemaViews)

thanks
LJB

Kevin Yu [MSFT]

unread,
May 6, 2004, 4:04:19 AM5/6/04
to
Hi LJB,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you got an error which says that
"Object or provider is not capable of performing requested operation" when
executing OpenSchema method. If there is any misunderstanding, please feel
free to let me know.

Based on the code you have provided, I found that you are trying to use an
enumeration value as an parameter for OpenSchema method. However,
enumerations are not supported in VB script. The value for adSchemaViews is
23. So we can just replace adSchemaViews with 23 to resolve the problem.
Here I have made some changes to your code and it works fine on my machine.
HTH.

Set con = CreateObject("ADODB.Connection.2.7")

con.open "Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\db1.mdb;"
Set rst = con.OpenSchema(23)

For more information, please check the following link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
mdcstschemaenum.asp

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

ljb

unread,
May 6, 2004, 8:01:50 AM5/6/04
to
You are exactly right. With Option Explicit not set I didn't get any warning
that adSchemaViews wasn't set to anything.

thank you

LJB

"Kevin Yu [MSFT]" <v-k...@online.microsoft.com> wrote in message
news:3t3dAD0M...@cpmsftngxa10.phx.gbl...

0 new messages