FoFa
Registered User.
- Local time
- Today, 13:08
- Joined
- Jan 29, 2003
- Messages
- 3,672
Trying to create a dynamic passthrough query using ADO.
So one of the parameters is the query name.
cat is an ADOX catalog
cmd is the ADO command
Where to start, the properties setting the pass-through to true fails
the properties setting connection fails
if i comment those out, it fails on the append as the object already exists.
If I comment the first on error out, it fails because the delete says it does not exist.
I know it can't exist and not exist at the same time.
So where am I going astray?
So one of the parameters is the query name.
cat is an ADOX catalog
cmd is the ADO command
Code:
cat.ActiveConnection = CurrentProject.Connection
on error resume next
cat.Views.Delete SPTQueryName
on error goto errortrap
cmd.ActiveConnection = cat.ActiveConnection
cmd.CommandText = sSQL
cmd.Properties("Jet OLEDB:ODBC Pass-Through Statement") = True
cmd.Properties("Jet OLEDB:Pass Through Query Connect String") = ConnectString
cat.Views.Append SPTQueryName, cmd
Where to start, the properties setting the pass-through to true fails
the properties setting connection fails
if i comment those out, it fails on the append as the object already exists.
If I comment the first on error out, it fails because the delete says it does not exist.
I know it can't exist and not exist at the same time.
So where am I going astray?