Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 24th, 2006, 01:33 PM
Registered User
 
Join Date: Mar 2006
Location: Ventnor, Isle of Wight, United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Removing the MsgBox in DoCmd.RunSQL Update

I have the following line of code and it works fine, apart from the warning message box that keeps appearing informing me that I am about to update 1 Row.

How do I stop the MsgBox appearing and prompting for a response?

DoCmd.RunSQL "UPDATE tblUser SET [User] = Forms![AddHrsPwd].[cboStaff] WHERE tblUser.[ID]='1'"
  #2 (permalink)  
Old March 24th, 2006, 01:43 PM
Wes Wes is offline
Registered User
 
Join Date: Mar 2006
Location: Bakersfield, CA, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this before your docmd.runSQL

DoCmd.SetWarnings False

then just before the end add:

DoCmd.SetWarnings True

This tells Access to tuen off those message boxes and then to turn them back on when you run this procedure.

Wes E.
  #3 (permalink)  
Old March 24th, 2006, 08:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Or use:

CurrentDb.Execute "UPDATE tblUser SET [User] = Forms![AddHrsPwd].[cboStaff] WHERE tblUser.[ID]='1'"

No message boxes, no need for DoCmd.SetWarnings

Bob



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using DoCmd.RunSQL to return values jscully Access VBA 10 August 21st, 2017 12:58 PM
Docmd.runsql anne.burrows VB How-To 2 October 25th, 2006 08:21 AM
DoCmd.RunSQL dates and time TarkaDahl Access VBA 3 May 11th, 2006 11:19 AM
docmd.runsql "select RodMead Access VBA 2 July 31st, 2004 02:55 PM
Help with DoCmd.RunSQL command ricmar Access VBA 3 July 21st, 2004 03:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.