Adam-
WHEN REPLYING ON THE WEB, CLICK "Show Message History" TO INCLUDE THE PREVIOUS CONVERSATION so we don't have to go digging for it.
If you want to see the result of running a query in the UI, then yes, it has to be saved.
As for running an "action" query from code, the Execute method is much preferred.
a) RunSQL runs asynchronously - your code will continue while the query may still be running. If you have code or other queries that depend on the "action" query to finish, it might not work. With Execute, your code will wait until the query finishes.
b) There is limited error trapping using RunSQL. If you use Execute with the dbFailOnError option, you can catch all errors in your code.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Feb 18, 2015, at 6:35 PM, runuphillracing@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
So does this mean you have to store non-action queries?
Also, for an action query, which is preferable, or what are the pros/cons of
"Db.Execute stSQL" vs. "docmd.RunSQL"
Thanks
Adam
On Feb 18, 2015, at 6:25 PM, John Viescas <johnv@msn.com> wrote:
Oh, then create and save a new query using a QueryDef object. You can then open the query in the UI (OpenQuery) or reference the query by name in Excel. A query has to be stored to be open in the UI. You can also modify the SQL of an existing query.
Open to view it. Also to manually copy and paste the data into a spreadsheet (no OutputTo or TransferSpreadsheet for now).
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
P.S. Please keep the thread intact. If replying on the web, be sure to click the Show Message History button.
On Feb 18, 2015, at 5:45 PM, runuphillracing@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Open to view it. Also to manually copy and paste the data into a spreadsheet (no OutputTo or TransferSpreadsheet for now).
__._,_.___
Posted by: John Viescas <johnv@msn.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (6) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar