过滤输出以报告Word [英] Filter OutputTo report for Word

查看:49
本文介绍了过滤输出以报告Word的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道如何过滤我输出到Word的报告。


使用以下2命令打印并输出到word。


strWhere是一个要打印的选定项目/行的列表,这很好用,但下一个命令我似乎无法过滤它。它输出完整的表,该表非常大。


DoCmd.OpenReport" Memo141Report" ,, strWhere


DoCmd。 OutputTo acOutputReport,Memo141Report,acFormatRTF,Selected141Report.rtf,True

Anyone have an idea how I can filter a report that I''m outputting to Word.

Using the following 2 Command to print and output to word.

The strWhere is a list of selected items/rows to print, and that works great, but the next command I can''t seem to get it to filter. It outputs the complete table, and that table is quite large.

DoCmd.OpenReport "Memo141Report", , , strWhere

DoCmd.OutputTo acOutputReport, "Memo141Report", acFormatRTF, "Selected141Report.rtf", True

推荐答案

您需要修改报告的查询在运行中


将原始查询的SQL文本存储在您的代码中,并将strWHERE添加到它中,如:


strSQLreport = "选择...来自...其中 &安培; strWhere


''这需要工具/参考Microsoft DAO版本#。##

dim qd as DAO.querydef

''以下查询需要用于报告,但内容将从代码填写

set qd = currentdb.querydefs(" qryReportOnTheFly")

''填写SQL

qd.SQL = strSQL


''现在激活OutputTo命令


获取想法?


Nic; o)
You''ll need to modify the report''s query "on the fly"

Store the original query''s SQL text in your code and add the strWHERE to it like:

strSQLreport = " select ... from ... where " & strWhere

'' This requires a tools/reference to Microsoft DAO version #.##
dim qd as DAO.querydef
'' the following query needs to be used for the report, but the contents will be filled from code
set qd = currentdb.querydefs("qryReportOnTheFly")
'' fill SQL
qd.SQL = strSQL

'' now activate the OutputTo command

Getting the idea ?

Nic;o)



你需要修改报告查询即时


将原始查询的SQL文本存储在代码中,并将strWHERE添加到其中,如:


strSQLreport ="选择...来自...其中 &安培; strWhere


''这需要工具/参考Microsoft DAO版本#。##

dim qd as DAO.querydef

''以下查询需要用于报告,但内容将从代码填写

set qd = currentdb.querydefs(" qryReportOnTheFly")

''填写SQL

qd.SQL = strSQL


''现在激活OutputTo命令


获取想法?


Nic; o)
You''ll need to modify the report''s query "on the fly"

Store the original query''s SQL text in your code and add the strWHERE to it like:

strSQLreport = " select ... from ... where " & strWhere

'' This requires a tools/reference to Microsoft DAO version #.##
dim qd as DAO.querydef
'' the following query needs to be used for the report, but the contents will be filled from code
set qd = currentdb.querydefs("qryReportOnTheFly")
'' fill SQL
qd.SQL = strSQL

'' now activate the OutputTo command

Getting the idea ?

Nic;o)



我想我明白了,会在一两天内尝试。在注释''填充SQL下面的strSQL的位置?

I think I understand, will try in a day or two. Where dose the strSQL below the comment '' fill SQL?


语句:

qd.SQL =" select ..."

将直接将SQL写入Access的已保存查询部分。


只需尝试使用qryDummy查看会发生什么:-)


Nic; o)
The statement:
qd.SQL = "select ..."
will directly write the SQL into the saved query section of Access.

Just give it a try with a qryDummy to see what happens :-)

Nic;o)


这篇关于过滤输出以报告Word的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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