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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
you can create the object using Querydef and used this to change your query at runtime based on the user slected criteria.
try like this
Dim query_1 as string
query_1 = "Select * from Table1 where ID = 'Your ID'"
CurrentDb.QueryDefs("Report_Query").sql = query_1
than open the report or make pdf ..
回答2:
You could populate a multiselect listbox from the same record source as the report, and then use the selected records from that to drive the actual report data.
You would probably want to build a PK IN(1,3,99,104...)
style criteria by looping through the selected items from the listbox.