Re: Suppress the SQL message

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Billy Yao [MSFT] (v-binyao_at_online.microsoft.com)
Date: 02/25/04


Date: Wed, 25 Feb 2004 08:56:37 GMT

Hi Karen,

Thank you for posting in the community.

>From your description, you would like to open a mail merge template in Word 2003.
However, you received the following message:

"Opening this will run the following SQL command:"

and the KB 825765 mentioned you could follow the method to add the "SQLSecurityCheck"
registry key to suppress this message. I understand you'd like to pursue some VBA solution
if possible.

I performed a further test with the following code, create a doc1.doc file on disk C,(type
some characters in the Word file). when the mail merge starts, I found this message didn't
appear in Word 2002/2000. In Word 2003,however, the message persists.

'''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Command1_Click()

   Dim oApp As Word.Application
   Dim oDoc As Word.Document
   
   'Create a new document in Word.
   Set oApp = New Word.Application
   Set oDoc = oApp.Documents.Open("C:\doc1.doc")
   
   'Make Word visible.
   oApp.Visible = True
   
   With oDoc.MailMerge
       
       .DataSource.ActiveRecord = wdLastRecord
       
       'Display the number of records that will be merged.
       Ret = MsgBox(.DataSource.ActiveRecord & " records will be " & _
                    "merged. Click Yes to continue or No to quit.", _
                    vbYesNo + VbMsgBoxSetForeground)

End Sub

''''''''''''''''''''''''''''''''''''''''''''''''

Based on my further researching, I found out that in Word 2003 it will display a message box
by default when you try to open a Word 2003 mail merge document that is linked to a data
source.

The default value is No and it will not run the SQL command. To make the SQL command
code
work, we need to create the following registry key and explicitly set its value 0:

HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Word\Options
"SQLSecurityCheck"=dword:00000000

Therefore, I need to say that there is no VBA solutions till now as the issue is by-design in
Word 2003. I wonder if you accept the method to add the "SQLSecurityCheck" registry key
to suppress the message. If you have any concerns, please feel free to let me know.

Best regards,

Billy Yao
Microsoft Online Support
----------------------------------------------------
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only. Thanks.



Relevant Pages

  • Re: Accesing aSQL view from C#
    ... get anythin back on asp.net if I run same SQL command on the SQL ... some of the previous questions in this newsgroup before posting yours - ... but this is a classic ADO newsgroup. ... ADO.Net bears very little resemblance to classic ADO so, ...
    (microsoft.public.data.ado)
  • More Database Help
    ... In anticipation of the day that I move to a different database... ... As I was writing this posting it dawned on me that UPDATE without a ... If you want to update the fields in the current record, what SQL command do ... Jeff ...
    (microsoft.public.fox.programmer.exchange)
  • RE: Intranet component will not install
    ... Business Server setup fails with the same 'x' next to Server Tools, ... This is a clean install of ClientX. ... to run SQL command, hr=0x80004005 ... > in the SQLDataRoot registry key value under this registry key path: ...
    (microsoft.public.windows.server.sbs)
  • 5-7-09 Patch Broke KB Fix 825765
    ... We have been using the registry key supplied in KB 825765 to suppress the ... "Opening this document will run the following SQL command:" warning that is ...
    (microsoft.public.word.mailmerge.fields)