Full Version: Run Maketable Query In Vba Without Popup Warnings
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
hbengineerskc
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.

DoCmd.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?

Thanks,

Kurt
bulsatar
Did you try setting the warnings flag to false?

docmd.setwarnings false
code...code...code...
docmd.setwarnings true
theDBguy
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
hbengineerskc
Thanks - very helpful!
hbengineerskc
Thanks! You guys at UA are providing a great service to us recreational hacks. Have a great 2012.
theDBguy
Hi,

QUOTE (hbengineerskc @ Jan 4 2012, 09:29 AM) *
Thanks! You guys at UA are providing a great service to us recreational hacks. Have a great 2012.

yw.gif

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 our main content. To view the full version with more information, formatting and images, please click here.