Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting multiple records 1

Status
Not open for further replies.

Davo67

Technical User
Jul 3, 2001
17
GB
Please can you help me, i'm new to CF! It's a simple problem for all you CF experts but I don't know where to start.
I need to view all the records from an Access database (i'm ok with this part)
Against each record I need a checkbox. I would then like to be able to tick certain records then click a button and have the selected records exported to an excel spreadsheet.

Thanking you in Advance ;)

Dave
 
I'm not sure if theres an easier/more efficient way to do this, but heres my first solution:

Add a field in the database to represent the checkboxes... call it 'Checked' perhaps?
On your submit, have it update those fields based on whether or not the box was checked.

Then make a new query to select all those records who have the checked field set.

Output those fields.

Hope that helps.

MG
 
I think the easiest way to handle this is to make the value for each check box the id (primary key) field for the current record. When the form is submitted, the checkbox field contains a list of all the records to export, so just run you query against that value [i.e. SELECT * FROM my_database WHERE id IN (#form.checkboxFieldName#) ] and viola, you have all your chosen record in a query, which you can then write to a file.

Hope this helps, it tends to be easier than modifying a database, especially when you could end up having several people needing the export. If that is the case, then you need to update your db after the write to set the check field in the db to no. This is a write that can be avoided, and really should be avoided in a production site, especially if it is a busy site or shared server.

David Giffin
Davtri Interactive Design
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top