Hi Ahmad,
When you build the page's HTML code, for the Next and Previous buttons generate anchors that contain the current record's key and point to NextRec.asp and PrevRec.asp, respectively:
Next record Previous recordThen, in the two ASPs, find the correct record and build the same page layout. The only difference between NextRec.asp and PrevRec.asp will be the SQL code.
In NextRec.asp, use
CurrRecKey = Request("CurrRecKey")
Cmd = "SELECT TOP 1 * FROM RecTable WHERE ID >" & CurrRecKey & " ORDER BY ID"
In PrevRec.asp use ORDER BY ID DESC"
CurrRecKey = Request("CurrRecKey")
Cmd = "SELECT TOP 1 * FROM RecTable WHERE ID <" & CurrRecKey & " ORDER BY ID DESC"
This assumes you're using SQL 7.0 or Oracle. Be careful about the use of "<" and ">".
Les
Les Pinter
(650) 344-3969
Les@LesPinter.com for consulting bookings.
www.LesPinter.com.
Watch for my forthcoming book on "Developing Database Applications in VFP and VB.NET".