I have an updated query attached to the "on close" event of a form in Access.
But now, before Access allows me to close the form, I get a warning that the
query is about to run and that "x" number of records will be changed.
How do I turn off this irritating warning/
Dirk Goldgar - 13 Jun 2005 20:43 GMT
> I have an updated query attached to the "on close" event of a form in
> Access. But now, before Access allows me to close the form, I get a
> warning that the query is about to run and that "x" number of records
> will be changed.
>
> How do I turn off this irritating warning/
Does your form use DoCmd.RunSQL or DoCmd.OpenQuery to run the query? If
so, you can replace that line with one like this:
CurrentDb.Execute "YourQueryNameOrSQL", dbFailOnError
The only problem with that would be if you query uses a reference to a
control on a form. In that case, the above won't work, and you would do
better to use code like this:
Private Sub Form_Close()
On Error GoTo Err_Handler
DoCmd.SetWarnings False
DoCmd.OpenQuery "YourQueryName"
Exit_Point:
DoCmd.SetWarnings True
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error " & Err.Number
Resume Exit_Point
End Sub

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Ofer - 13 Jun 2005 21:23 GMT
Put the code
docmd.SetWarnings false
before running the query, that will turn off this irritating warning
and after running the query change it back to true
docmd.SetWarnings True
> I have an updated query attached to the "on close" event of a form in Access.
> But now, before Access allows me to close the form, I get a warning that the
> query is about to run and that "x" number of records will be changed.
>
> How do I turn off this irritating warning/