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
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."
thank you
LJB
"Kevin Yu [MSFT]" <v-k...@online.microsoft.com> wrote in message
news:3t3dAD0M...@cpmsftngxa10.phx.gbl...