prayingmantes
prayingmantes

Reputation: 155

Using a checkbox on a form to flag record for export

I have a MS Access 2010 form with a query as the record source. I want to display all records that the query returns, and give the user an option to check any number of boxes, and when finished, a) export all the checked records to MS Excel, and b) hide those records from the form the next time it is opened.

I have tried to do this with unbound checkboxes on a continuous form (dynaset recordset type), but when I check the box for one record every checkbox for every record becomes checked, not allowing me to choose which ones I want to export individually.

Upvotes: 2

Views: 4436

Answers (2)

BitAccesser
BitAccesser

Reputation: 719

This is possible with the clsCCRecordSelect class from Bitsqueezer's SelectRecordsV2 database! It's a must-have for selecting records in a continuous form!

Upvotes: 0

mwolfe02
mwolfe02

Reputation: 24207

You can't do what you want with unbound checkboxes. Unbound controls are called that because they are not bound to an individual record. You have two main options:

Add a Yes/No field to your table

Add a yes-no field to your table. Bind the checkbox to this new field.

Use this approach if you want your other fields to be "edit-able" and you can make changes to your schema.

Use a multi-select listbox

Switch your form from continuous to single and add a multi-select listbox. Then loop through the selected items to create an IN () clause for your export query.

Use this approach if you don't want to make changes to your schema. Also, you can set the listbox to accept Shift-Click selection of many contiguous records. That may be less labor-intensive for your users.

Upvotes: 2

Related Questions