Full Version: INSERT statement in a Form: Are you sure?
UtterAccess Forums > Microsoft® Access > Access Forms
aaronbdavis
When you run DoCmd.RunSQL in a form with an insert statement, a Confirm box pops up saying "You are about to append 1 row(s). are you sure you wish to continue....."
Is there a way to catch that event and either completely ignore the confirm box or spit out your own message? "You are about to append yada yada..." isn't terribly user friendly and I don't want the end-user to see that message.
thanks for any help in advance.
kbrewster
Before your insert statement put...
ocmd.SetWarnings False
then after your insert statement
Docmd.SetWarnings True
RuralGuy
If you use CurrentDB.Execute you do not get the questions.
HiTechCoach
I really is better to use:

CurrentDB.Execute

for

DoCmd.RunSQL

Then you do not have to worry about tutning the warning on off then back on.

Plus it also executes faster.

Edited by: HiTechCoach on Tue Jan 17 14:11:04 EST 2006.

Looks like RuralGuy types faster
R. Hicks
Setting the Warning Off is not a good programming pratice when Action queries are involved ...
If the query should encounter an error for any reason .. the user will never be aware that there was a problem.
The proper method to run an Action query is to use the Execute method ...
With this method .. there will be no warning unless the query encounters an error ...

RDH
RuralGuy
Not really Boyd, I just give shorter answers. wink.gif
kbrewster
OK I GET IT...I was way wrong on this one!! laugh.gif
At least I know this for my own good as well!
R. Hicks
That was the only reason I replied to the thread .. was to explain why not to set the warnings to off ...
DH
HiTechCoach
Kristen,
Oused to use the "set warnings" until I learned from Utter Access that there was a better way!
kbrewster
Well I am glad I know now! frown.gif
Thanks!
aaronbdavis
Wow... thanks for all the replies. I'll have to go fix my code now.
Thanks again
Aaron
R. Hicks
You are welcome .. wink.gif
DH
HiTechCoach
Good luck with your project!
uarulez2.gif
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.