Confirm Data Source Dialog Displayed w/MailMergeOpenDataSource

Last reviewed: February 5, 1998
Article ID: Q121611
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows 95, version 7.0

SYMPTOMS

A WordBasic macro that contains the MailMergeOpenDataSource command to connect a Mail Merge main document to a FoxPro or Dbase data source displays the Confirm Data Source dialog box. For example, the following macro prompts you to confirm the data source:

Sub MAIN
Q$ = Chr$(34) connect$ = "DSN=FoxPro Files;" connect$ = connect$ + "DBQ=c:\foxprow;" connect$ = connect$ + "FIL=FoxPro 2.5;" MailMergeOpenDataSource .Name = "c:\foxprow\foxuser.dbf", .Connection = connect$
End Sub

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

CAUSE

This problem occurs when the .SQLStatement argument is omitted from the MailMergeOpenDataSource command.

RESOLUTION

To eliminate the prompt to confirm the data source, modify the macro to include the .SQLStatement argument, as in the following example:

Sub MAIN
Q$ = Chr$(34) connect$ = "DSN=FoxPro Files;" connect$ = connect$ + "DBQ=c:\foxprow\foxuser.dbf;" connect$ = connect$ + "FIL=FoxPro 2.5;" MailMergeOpenDataSource .Name = "c:\foxprow\foxuser.dbf", .Connection = connect$, .SQLStatement = "Select * from foxuser.dbf"
End Sub

For additional information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q110334
   TITLE     : WordBasic Examples Using ODBC: MailMergeOpenDataSource

REFERENCES

"Microsoft Word Developer's Kit," version 6.0, pages 579-580

The Microsoft Access ODBC Help files DRVFOX.HLP and DRVDBASE.HLP, which are located in the Windows SYSTEM subdirectory.


KBCategory: kbusage kbinterop kbmacro
KBSubcategory: kbmacroexample
Additional reference words: 6.0 6.0a 6.0c winword fox pro foxpro
7.0 word95 access sql mail merge mailmerge print merge dbase database
word7 word6
Keywords : kbmacroexample
Version : 6.0 6.0a 6.0c 7.0
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.