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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving previous record having filtered values

Status
Not open for further replies.

daveigh

Programmer
Oct 9, 2003
105
Hi guys, im having problems retrieving previous records for a detail page. I have a page:


and i want to show the previous record. I cant use subtraction in order to get the previous record since some of them doesnt fit the filter i made. i get "Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record" error.

sql2 = "SELECT * FROM template WHERE uid BETWEEN "& bawas &" AND shownwhere = 'regular' AND activestatus = true ORDER BY uid asc;"

can somebody help me on this? even a sample code will be very much appreciated. thanks!

_______________CRYOcoustic_____________
 
Maybe this might work:

sql2 = "SELECT TOP 2 * FROM template WHERE uid BETWEEN "& bawas &" AND shownwhere = 'regular' AND activestatus = true ORDER BY uid DESC"

My logic is that you will receive the last 2 UIDs that fit that query and then reverse the order so the first one returned would be the second from the last.
 
Oops, that won't work. you have to order it by UID ASC

the record you want is the second one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top