Re-sort a table by user-selected variable
Posted on 2004-11-20
I'm using an Access 2000 db as the data source for a table on a web page that's generated with ASP.
The table looks like:
Project Name Coordinator Product
Project X Kitty Rule
Project Me Bear Rule
Nuke 'Em Kitty Lawsuit
When the page appears the first time, the projects are sorted by project name.
I'd like to be able to allow the user to click on the column heading (which is also the field name) to re-sort the output by that field.
I've been trying to get this to work by setting the column names up as:
thinking that a click on that link should set the variable pickorder equal to the desired field name.
The asp code then says:
strsql="SELECT * from tblProjects ORDER BY '" & pickorder & "'"
When I click on a link, the URL indicates "it" understands that pickorder is equal to Coordinator but it doesn't re-sort the data.
What am I doing wrong?
If you need more code, just ask. I'm a newbie so I don't know when enough is too much and I thought I'd spared you digging through a bunch of irrelevant stuff.
Thanks in advance.