By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 852 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

vba how to suppress dialog when modifying records

P: n/a
Hi,
whan I have for example a vba script

stSql = "INSERT INTO table..."
DoCmd.RunSQL stSql

associated with a command, and then I click on it there is an access
popup that informs me how many rows will be affected (inserted,
deleted...).

How can I suppress this dialog?

Thanks,
Lorenzo

May 9 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Use DoCmd.SetWarnings False to torn warnings off
Use DoCmd.SetWarnings True to torn warnings on

Sub test()
Dim stSql
stSql = "INSERT INTO Temp values(""fred"")"
DoCmd.SetWarnings False
DoCmd.RunSQL stSql
DoCmd.SetWarnings True

End Sub

Cheers,
Alan

lory <gi***************@gmail.comwrote in
news:11**********************@h2g2000hsg.googlegro ups.com:
Hi,
whan I have for example a vba script

stSql = "INSERT INTO table..."
DoCmd.RunSQL stSql

associated with a command, and then I click on it there is an access
popup that informs me how many rows will be affected (inserted,
deleted...).

How can I suppress this dialog?

Thanks,
Lorenzo

May 9 '07 #2

P: n/a
easiest way to do this without having to keep track of whether
warnings are turned on or off is to execute the query directly via
DAO, i.e.

CurrentDB.Execute "INSERT INTO table..."

or ADO if you like... but that's more hassle and probably not worth it
unless you are running and ADP

May 9 '07 #3

P: n/a
On May 9, 3:24 am, Alan Carpenter <N...@iHome.nzwrote:
Use DoCmd.SetWarnings False to torn warnings off
Use DoCmd.SetWarnings True to torn warnings on

Sub test()
Dim stSql
stSql = "INSERT INTO Temp values(""fred"")"
DoCmd.SetWarnings False
DoCmd.RunSQL stSql
DoCmd.SetWarnings True

End Sub

Cheers,
Alan

lory <giannotti.lore...@gmail.comwrote innews:11**********************@h2g2000hsg.googleg roups.com:
Hi,
whan I have for example a vba script
stSql = "INSERT INTO table..."
DoCmd.RunSQL stSql
associated with a command, and then I click on it there is an access
popup that informs me how many rows will be affected (inserted,
deleted...).
How can I suppress this dialog?
Thanks,
Lorenzo- Hide quoted text -

- Show quoted text -
If you use the SetWarnings to TURN warnings on and off be sure to call
the SetWarnings True in the Exit_Routine secion of your sub. If you
dont anfd the code crashed then the SetWarnings may or may not be
processed. Learn to error trap and use it in all of your code.

May 9 '07 #4

P: n/a
On 9 Mag, 21:40, DavidB <j...@yahoo.comwrote:
On May 9, 3:24 am, Alan Carpenter <N...@iHome.nzwrote:


Use DoCmd.SetWarnings False to torn warnings off
Use DoCmd.SetWarnings True to torn warnings on
Sub test()
Dim stSql
stSql = "INSERT INTO Temp values(""fred"")"
DoCmd.SetWarnings False
DoCmd.RunSQL stSql
DoCmd.SetWarnings True
End Sub
Cheers,
Alan
lory <giannotti.lore...@gmail.comwrote innews:11**********************@h2g2000hsg.googleg roups.com:
Hi,
whan I have for example a vba script
stSql = "INSERT INTO table..."
DoCmd.RunSQL stSql
associated with a command, and then I click on it there is an access
popup that informs me how many rows will be affected (inserted,
deleted...).
How can I suppress this dialog?
Thanks,
Lorenzo- Hide quoted text -
- Show quoted text -

If you use the SetWarnings to TURN warnings on and off be sure to call
the SetWarnings True in the Exit_Routine secion of your sub. If you
dont anfd the code crashed then the SetWarnings may or may not be
processed. Learn to error trap and use it in all of your code.- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -
Thanks a lot. Now it is ok.

May 18 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.