Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.RunSQL generates warning screen 2

Status
Not open for further replies.

Soundsmith

Programmer
Feb 21, 2001
84
US
I'm generating a series of SQL UPDATE commands to locate records. The commands take the form of:
DoCmd.RunSQL "UPDATE qryPikNames SET ok = True"

Each time the command runs I get a MsgBox:
"You are about to update nnnn rows" and an "Are you sure" selection.

How can I avoid these? I need to simply run the SQL commands with no questions asked.
Also, it takes a relatively long time to run the command against 2600 records. Any ideas for speeding it up?

Thanks.


David 'Dasher' Kempton
The Soundsmith
 
you could set warnings to false before the docmd
and restore it to true after, but I suspect there is an easier way especially if you're not satisfied with the performance now.

what are you trying to do?
 
Either of these methods will work:

Dim db as Database
Set db = Currentdb
db.Execute "UPDATE qryPikNames SET ok = True"
db.Close

OR

Docmd.SetWarnings False
DoCmd.RunSQL "UPDATE qryPikNames SET ok = True"
Docmd.SetWarnings True
Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
Thanks to both of you. As it turns out, all i needed to do was set the Confirm flag off in Tool/Options, but SetWarnings was the approach I was looking for and didn't find. I'll probably try the db.Execute in another selection, to see how much difference there is between them.
Also, I simplified my follow-on UPDATE queries and it made a significant difference. The time was apparently taken there, not in the initial UPDATEs. Again, I appreciate the help. David 'Dasher' Kempton
The Soundsmith
 
Remember that if you set the Set Warnings off in the options, then NO warnings will be used. If you want to use the RunSQL method, I would suggest setting the warnings to off (false) ONLY when you need to, them turn them back on. Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top