>> ADOX.Catelog

J

Jonathan Parminter

Hi, I want to change the sql of an Access Project
query/view (has SQL back end). This is normally simple
using dao. But I can't seem to figure it out using the
Catelog collection.

Here is a snippet of code:
**** code start ***

Dim strQueryName As String
Dim cat As New ADOX.Catalog
Dim cmd As New ADODB.Command
Dim strSQL As String

strQueryName = lstSelectReport.Column(2)

With cat
.ActiveConnection = CurrentProject.Connection
Set cmd = cat.Views(strQueryName).Command
End With

strSQL = cmd.CommandText

' code to amend the sql

cmd.CommandText = strSQL
Set cat.Views(strQueryName).Command = cmd

*** code end ***

the line:
Set cmd = cat.Views(strQueryName).Command

has the error:
object or provider is not capable of performing requested
operation

Any ideas or suggestions appreciated :)
Thanks
Jonathan
 
Top