Jens Wilken
Jens Wilken

Reputation: 31

Access: Print selected records form query

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?

Upvotes: 0

Views: 1725

Answers (2)

Tarun. P
Tarun. P

Reputation: 442

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 ..

Upvotes: 1

Minty
Minty

Reputation: 1626

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.

Upvotes: 1

Related Questions