How can I run sql command with no cofirmation alert through VBA

hi guys

i want to delete a record from another table in After-Update event of a text item in ms access form. the problem is the confirmation alert asking whether u want to delete or not. i don't want this alert to be displayed and I want to delete the record anyway. The code i'm using is

docmd.runsql "delete from discarded where sr_no=' " & Form_INV.sr_no & "'"

plz tell me how can I bypass this alert?

Thanks Khawar Pasha khawarpasha@hotmail.com

[598 byte] By [khawarpasha] at [2007-12-22]
# 1

Here's an example of what to do, make sure you turn warnings back on when your finished.

DoCmd.SetWarnings(False)

DoCmd.RunSQL

DoCmd.SetWarnings(True)

DerekSmyth at 2007-8-30 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...
# 2
How can we modify this to store the Warnings status first?

This code would turn warnings on for those that already have it switched off.

Something like...

Dim Warn as Bool
Warn = Something.GetWarnings()

DoCmd.SetWarnings(False)

DoCmd.RunSQL

DoCmd.SetWarnings(Warn)


Cheers,


Fylar


Fylar at 2007-8-30 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...