OK...
What I have is table listing Product Groups like so:
Code:
tblProductGrp
--------------------------
GroupName | ListOrder | ID
--------------------------
Group1 | 1 | 1
Group2 | 2 | 2
Foobar | 4 | 3
Splon | 3 | 5
These are output onto a page, ordered by ListOrder.
As part of the web-based admin for this, I need to be able to reorder the output (i.e. change the ListOrder values). Currently this is done by using "Move this value up" and "Move this value down" URLs which pass the following parameters:
Current ListOrder value = #URL.CurrentOrd#
ID = #URL.ID#
Action (move up or down) = #URL.Action#
The code to process this is (in part):
Code:
<cfif URL.Action is "MoveUp">
<!--- error catching --->
<cfif URL.CurrentOrd is 1>
<cfoutput>
<p>You cannot move this value any further up the list</p>
<p>Go <a href="sup_options.cfm">back</a></p>
</cfoutput>
<cfabort>
</cfif>
<!--- decrement the ListOrder by 1 --->
<cfquery datasource="SuppInfo" dbtype="ODBC" name="MoveGrpUp">
UPDATE tblProductGrp
SET ListOrder = #URL.CurrentOrd#-1
WHERE ID = #URL.ID#
</cfquery>
</cfif>
There is no problem with incrementing/decrementing the ListOrder as shown above. But what I want to be able to do is increment one and decrement the value immediately above it (or vice versa). So I need to pass an UPDATE that updates two records at once. Access seems to have problems with that (and doesn't like it if I try passing two sequential statements either - really funny things happen then).
Ideas?
Bookmarks