locked
Word 2013 with embedded sql server connection RRS feed

  • Question

  • In an existing word 2013 document, there is an embedded odbc connection that I have a few questions about which are:

    1. When I hit ALt-F9, I see something like the following:

    {MERGEFIELD FirstName  } {MERGEFIELD LastName}

    {MERGEFIELD mailAddress }

    {MERGEFIELD CityStateZip  }

    These values are apparently coming from the database. Thus would you tell me how these fields were setup? Would you tell me how I can add additional fields that come from the database and place them on this word document?

    2.  I would like to know how to find the existing connection to the word document and change the connection if I need to. Below is a picture of what is displayed when the document opens, it is a select to the database. I view is really displayed but I  found this example to show you what I mean.

    Wednesday, February 8, 2017 5:41 PM

Answers

  • Hi,

    The feature you mention is Mail Merge feature in Word:

    https://support.office.com/en-us/article/Use-mail-merge-to-create-and-send-bulk-mail-labels-and-envelopes-f488ed5b-b849-4c11-9cff-932c49474705

    Q1: These values are apparently coming from the database. Thus would you tell me how these fields were setup? Would you tell me how I can add additional fields that come from the database and place them on this word document?

    A1: From your uploaded picture, these Mail Merge field is referred to the worksheet "Sheet1" from an Excel file. You can do the following setting to insert more field: In the Mailings tab, click Insert Merge Field.

    Q2:  I would like to know how to find the existing connection to the word document and change the connection if I need to.

    A2: In the Mailings tab, click Edit Recipient List to check the current data source:

    If you want to change the connection, we can click Select Recipients > Use an Existing List to browse your wanted list.

    Any further question on the issue, please feel free to let me know :)


    Regards,

    Winnie Liang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Thursday, February 9, 2017 10:04 AM

All replies

  • The mergefields are normally inserted via Mailings|Insert Merge Field. That dialogue will also reveal any other data fields that could be added to the document.

    The SQL prompt in your screenshot indicates the data source is 'Sheet1' in an Excel workbook. My reply in your other thread (https://social.msdn.microsoft.com/Forums/office/en-US/83f74fee-fbd4-4aa7-a33f-ad2c79d692f8/writing-vba-code-for-a-word-2013-document?forum=worddev) shows a way of getting all the mailmerge parameters. If you want to change the data source, you could just answer 'No' to the SQL prompt, then use Mailings|Select Recipients>Use Existing List to navigate to the new data source. Do be aware, however, that any mismatches between the available fields in the new source and those specified in your mailmerge main document are likely to lead to errors.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Thursday, February 9, 2017 1:37 AM
  • Hi,

    The feature you mention is Mail Merge feature in Word:

    https://support.office.com/en-us/article/Use-mail-merge-to-create-and-send-bulk-mail-labels-and-envelopes-f488ed5b-b849-4c11-9cff-932c49474705

    Q1: These values are apparently coming from the database. Thus would you tell me how these fields were setup? Would you tell me how I can add additional fields that come from the database and place them on this word document?

    A1: From your uploaded picture, these Mail Merge field is referred to the worksheet "Sheet1" from an Excel file. You can do the following setting to insert more field: In the Mailings tab, click Insert Merge Field.

    Q2:  I would like to know how to find the existing connection to the word document and change the connection if I need to.

    A2: In the Mailings tab, click Edit Recipient List to check the current data source:

    If you want to change the connection, we can click Select Recipients > Use an Existing List to browse your wanted list.

    Any further question on the issue, please feel free to let me know :)


    Regards,

    Winnie Liang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Thursday, February 9, 2017 10:04 AM