Options:
1. SetWarnings suppresses warnings associated with action queries.
Advantages:
Simple to set.
Suppresses all messages.
Disadvages:
You don't know if the query worked or not.
You can't read the SetWarnings state.
2. Use the Execute method in code, instead of RunSQL.
Advantages:
With dbFailOnError, you can get a warning only if the action fails.
Disadvantages:
Cannot use the Expression Service to resolve names like:
[Forms]![Form1]![TextBox2]
so need to build the SQL string dynamically.
3. For the file overwrite warning, use Dir() to test if the target file
exists, and Kill it before your export. Example:
Dim strFile As String
strFile = "C:\MyFolder\MyFile.csv"
If Len(Dir(strFile)) > 0 Then
Kill strFile
End If
DoCmd.TransferText ...
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
TREVOR-RUDGE said:
I need to turn off ALL warning messages.. for example... when i run a make
table query - i DONT want a messages saying the existing table will be
deleted. ALSO when exporting a file to excel I dont want to know that the
file already exists...