访问:打印选定的记录表格查询 [英] Access: Print selected records form query
问题描述
我真的不知道该如何开始.我有一个报告,该报告从查询中获取记录.查询本身从表中获取记录.现在,我希望能够通过id手动选择查询中的记录.但是记录之间没有任何联系,所以我不能说给我ID x和y之间的所有记录".同样,记录的数量也不总是在变化.我希望用户能够说:好的,我需要打印这些x id的所有数据".我该如何存档?
I really don't know how to start this. I have a report, that takes records from a query. The query itself takes the records from a table. Now I want to be able to select the records in the query by the id manually. But there is no connection between the records, so I can't say 'give me all records between id x and y'. Also, there is not the count of records always changing. I want a user to be able to say: 'okay, I need to print all the data of these x ids'. how can I archive this?
推荐答案
您可以使用Querydef创建对象,并使用该对象根据用户选择的标准在运行时更改查询.
you can create the object using Querydef and used this to change your query at runtime based on the user slected criteria.
尝试这样
Dim query_1 as string
query_1 = "Select * from Table1 where ID = 'Your ID'"
CurrentDb.QueryDefs("Report_Query").sql = query_1
比打开报告或制作pdf ..
than open the report or make pdf ..
这篇关于访问:打印选定的记录表格查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!