MS Word,基于合并字段的查询条件导入表 [英] MS Word, Import Table with Query Condition Based on Merge Field

查看:19
本文介绍了MS Word,基于合并字段的查询条件导入表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的组织创建合规邮件,邮件将包含标识办公地点、医生和 SiteId 的合并字段.邮件还将包括一个依赖于特定 SiteId 的信息表.

I'm creating a compliance mailing for my organization, the mailing will include merge fields that identify the office location, physician, and SiteId. The mailing will also include a table of information that is dependent upon the particular SiteId.

我想使用 MS Word 的导入表功能并设置一个引用合并字段 (SiteId) 的查询,以便插入的表填充特定站点的适当数据.我无法做到这一点.

I'd like to use the import table function of MS word and set up a query that references a merged field (SiteId) so that the inserted tables populate the appropriate data for the particular site. I'm unable to do this.

如何设置此文档,以便仅从与 SiteId 合并字段匹配的源(ms access 查询)导入记录?

How can I set up this document so that I can import only records from my source (an ms access query) that match the SiteId merge field?

推荐答案

Word 的邮件合并不支持一对多关系.有很多方法可以强制它,但只有其中一种方法可以产生一个表,并且多年来它变得越来越不可靠,因为 Microsoft 认为它不够重要以维护......

Word's mail merge does not support one-to-many relationships. There are ways to coerce it, but only one of them can yield a table as a result and over the years it has become less and less reliable as Microsoft has not regarded it as important enough to maintain...

您需要做的是设置一个查询,该查询仅提供您希望在表中显示的信息以及键 (SiteId).最好对其进行排序,以便将所有 SiteId 条目列出在一起,并按照数据在邮件合并数据源中的顺序排列.

What you need to do is set up a query that provides ONLY the information you want displayed in the table, plus the key (SiteId). It's best to sort it so that all the SiteId entries list together, and are in the order the data will come through in the mail merge data source.

在插入选项卡上,转到文本/快速部件/插入字段,然后从对话框的列表中选择数据库字段.单击插入数据库"并按照对话框中的说明链接数据.请务必将查询选项设置为筛选数据源中的第一个 SiteId.当您插入数据"时,请确保选择作为字段插入"选项.

On the Insert tab go to Text/Quick Parts/Insert Field and select the Database field from the list in the dialog box. Click "Insert Database" and follow the instructions in the dialog box to link in the data. Be sure to set the Query Options to filter on the first SiteId from the data source. When you "Insert Data" make sure to choose the option to "Insert as a field".

这会在文档中插入一个 DATABASE 字段,您可以通过切换字段代码 (Alt+F9) 看到该字段.字段代码可以编辑,您需要做的是用相应的 MergeField 替换您为查询输入的文字 SiteId 值.

This inserts a DATABASE field in the document which you can see by toggling field codes (Alt+F9). The field code can be edited and what you need to do is substitute the literal SiteId value you entered for the query with its corresponding MergeField.

当您对新文档执行合并时,应该为与记录的 SiteId 对应的每个数据记录生成一个表.但是,正如我所说,微软在维护这一点方面做得并不好,因此可能需要进行大量调整和试验.

When you execute the merge to a new document that should generate a table for each data record corresponding to the SiteId for the record. But, as I said, Microsoft hasn't done a great job of maintaining this, so it may require quite a bit of tweaking and experimenting.

如果结果不令人满意,那么你应该放弃邮件合并的想法,使用自动化代码来生成和填充文档.

If the results are not satisfactory then you should give up the idea of mail merge and use automation code to generate and populate the documents.

您可以在 http://homepage.swissonline.ch/cindymeister/mergfaq1.htm

这篇关于MS Word,基于合并字段的查询条件导入表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆