Domanda

I'm building a front end for an Access database. My users don't want or need to see the "You about to insert X records" sort of messages that come up when you run an INSERT, UPDATE or DELETE query.

The only way I've been able to find to turn these messages off programtically is DoCmd.SetWarnings False in VBA and then turning them on afterwards. However, this disables all warnings, and if the code errors before the DoCmd.SetWarnings True command, then they stay off, which can be anything from a nuisance to dangerous.

Is there any way of supressing only the SQL warnings in Access and leaving others (e.g. the "do you want to save this query" messages) intact?

È stato utile?

Soluzione

Run "action queries" with Database.Execute or QueryDef.Execute instead of DoCmd.RunSQL.

The .Execute methods do not trigger those confirmation messages, so no motivation to use SetWarnings False to suppress them.

Altri suggerimenti

There is also this alternative, for those not wanting to write code Access Options

In Access Options > Advanced > Uncheck the required confirmation for the desired fields.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top