You can either issue a DoCmd.SetWarnings False before running the query, and
DoCmd.SetWarnings True afterwards, or you can use the Execute method of the
QueryDef object. I prefer the latter, because it also allows you to specify
dbFailOnError as an option, meaning that a trappable error will be raised if
something goes wrong running the query.
CurrentDb.QueryDefs("MyActionQuery").Execute dbFailOnError

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> what code do I write to run a query without getting a warning ?
> and I dont want to set it by the access options because then it dose not
> warn me by running any query.