How do I turn off ALL warning messages-ie table will be deleted..

T

TREVOR-RUDGE

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...
 
A

Allen Browne

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 ...
 
T

TREVOR-RUDGE

Thanks,

Ive tried set warnings, but it doesnt seem to do anything for the messages i
am getting. I do not know VB so the rest of your response is interesting but
sadly not useful.
Is there no global - I dont want the messages setting? - If you know and
intend the query to delete a table before creating it again, the messages are
annoying to say the least!

Trevor

Allen Browne said:
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...
 
A

Allen Browne

Presumably you have also tried the settings under:
Tools | Options | Edit/Find | Confirm.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

TREVOR-RUDGE said:
Thanks,

Ive tried set warnings, but it doesnt seem to do anything for the messages
i
am getting. I do not know VB so the rest of your response is interesting
but
sadly not useful.
Is there no global - I dont want the messages setting? - If you know and
intend the query to delete a table before creating it again, the messages
are
annoying to say the least!

Trevor

Allen Browne said:
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 ...

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...
 
Top