Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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
 
Old June 9th, 2004, 08:26 AM
Authorized User
 
Join Date: May 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Cr0vaX
Default Auto OK on UPDATE Dialog

DoCmd.RunSQL "UPDATE Contador SET Contador.OTrabalho = " & _
                 CStr(rsContador.Fields(0).Value + 1) & _
                 " WHERE (((Contador.Ano)='" & CStr(intAnoCorrente) & "'));"

I have this code to update a table, but when it comes to this it'll show a dialog box asking OK or Cancel.

What I want to do is "auto click" OK, or don't ask just update, is there anyway?

 
Old June 9th, 2004, 11:06 AM
Authorized User
 
Join Date: Nov 2003
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use the SETOPTION method prior to your DoCmd statement. It would look similar to the following:
Code:
'Turn off Update Confirmation
SETOPTION "Confirm Action Queries", No

DoCmd.RunSQL "UPDATE Contador SET Contador.OTrabalho = " & _
                 CStr(rsContador.Fields(0).Value + 1) & _
                 " WHERE (((Contador.Ano)='" & CStr(intAnoCorrente) & "'));"

'Turn on Update Confirmation
SETOPTION "Confirm Action Queries", Yes



Darrell L. Embrey
 
Old June 11th, 2004, 04:54 AM
Authorized User
 
Join Date: May 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Cr0vaX
Default

That's it !

it works just fine :D

thank you

 
Old June 24th, 2004, 01:24 AM
Authorized User
 
Join Date: Jun 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why not this... :)

DoCmd.SetWarnings 0 or 1

I know both or same but it save space ... and easy ..too

Stay Beautiful,

Abdul Salam

There is no moving creature on Earth whose sustenance is not provided by Allah. He knows its living and its resting place,
and all that is recorded in a glorious Book. (Al-Quran)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Update of script file.... rupen Javascript How-To 2 November 17th, 2006 11:03 AM
Auto update timestamp field TwoNames PHP Databases 2 September 26th, 2004 06:01 PM
auto-update multiple records in subform stoneman Access 1 February 8th, 2004 12:19 AM
auto update table field nkrukovsky Access VBA 2 November 4th, 2003 05:28 PM
Auto update of client... ideas? LH Access 2 September 26th, 2003 02:10 PM





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