UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Run Maketable Query In Vba Without Popup Warnings, Office 2007    
 
   
hbengineerskc
post Jan 4 2012, 10:47 AM
Post #1

UtterAccess Member
Posts: 30



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
Go to the top of the page
 
+
bulsatar
post Jan 4 2012, 10:52 AM
Post #2

UtterAccess Ruler
Posts: 1,175
From: Indiana, USA



Did you try setting the warnings flag to false?

docmd.setwarnings false
code...code...code...
docmd.setwarnings true
Go to the top of the page
 
+
theDBguy
post Jan 4 2012, 10:53 AM
Post #3

Access Wiki and Forums Moderator
Posts: 48,100
From: SoCal, USA



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... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+
hbengineerskc
post Jan 4 2012, 11:28 AM
Post #4

UtterAccess Member
Posts: 30



Thanks - very helpful!
Go to the top of the page
 
+
hbengineerskc
post Jan 4 2012, 11:29 AM
Post #5

UtterAccess Member
Posts: 30



Thanks! You guys at UA are providing a great service to us recreational hacks. Have a great 2012.
Go to the top of the page
 
+
theDBguy
post Jan 4 2012, 01:09 PM
Post #6

Access Wiki and Forums Moderator
Posts: 48,100
From: SoCal, USA



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.

(IMG:style_emoticons/default/yw.gif)

bulsatar and I (and the rest of UA) are happy to help.

Good luck with your project.

Happy New Year! (IMG:style_emoticons/default/fundrink.gif)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 24th May 2013 - 03:58 PM