I have an Access database with a single query in it. I can currently copy the query via VBA, using DoCmd.CopyObject. However, I need to be able to edit the SQL in each instance of the query individually. All the examples I have seen, however, involve recordset, which is something I am not using.
Any ideas?
The question is a bit thin on what kind of query you want to edit, but say it is a select query that doesn’t need any dynamic parameters.
Then, using the
CopyObjectmethod, make a copy of the query as you did. Use theCatalogobject (you will need to reference the ADO Ext). Then, you can just change the SQL of the copy as below. Depending on your query, it may be a View or a Procedure, but a Select query should be listed as a View.