Full Version: Run Maketable Query In Vba Without Popup Warnings
UtterAccess Forums > Microsoft® Access > Access Queries
I use a make-table query to import data from an ODBC source. Using VBA, I delete the old table and then use the following code to run the query.
oCmd.OpenQuery "qryInvoiceLine"
Before running the query, I get a popup asking "You are about to run a make-table query that will modify data in your table... <Yes> <No>"
After running the query, I get another popup "You are about to paste 1202 row(s) into a new table... <Yes> <No>"
is there a way to avoid these popups so the queries create the tables silently?
Did you try setting the warnings flag to false?
ocmd.setwarnings false
docmd.setwarnings true
Hi Kurt,
Creating and deleting tables at runtime could cause database bloat. It is highly recommended to just empty out the table and then use an APPEND query to add the new data in.
Either way, try the following syntax to avoid the warning message but still recover in case any error occurs, which you can't do with the SetWarnings method:
CurrentDb.Execute "qryInvoiceLine", dbFailOnError
Just my 2 cents... 2cents.gif
Thanks - very helpful!
Thanks! You guys at UA are providing a great service to us recreational hacks. Have a great 2012.
bulsatar and I (and the rest of UA) are happy to help.
Good luck with your project.
Happy New Year! fundrink.gif
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.