View Full Version : Filter page by ID or by Last Record inserted

08-28-2011, 04:54 PM
Hi guys,
using DW CS5, asp & access i make a page filter by ID using this code

Dim rs__MMColParam
rs__MMColParam = "1"
If (Request.QueryString("field") <> "") Then
rs__MMColParam = Request.QueryString("field")
End If

but this page i use non only for reach data filter by id, but as page that can get the last record insert, instead to create another page for this...

How i have to do to get 1 page by ID or by last record?

10-12-2011, 05:08 PM
I don't think you can get a page by ID or last record but you can certainly get a page that is sorted by ID and is also the last record:

I use the following code on a bar website in conjunction with a repeat region to show the full list of coctails, normally I'd 'ORDER BY Price DESC' but for your purposes 'ORDER BY ID ASC' should do the trick ( try DESC if ASC doesn't do it for you )

Dim cocktailsRS
Dim cocktailsRS_numRows

Set cocktailsRS = Server.CreateObject("ADODB.Recordset")
cocktailsRS.ActiveConnection = MM_databaseConn_STRING
cocktailsRS.Source = "SELECT * FROM TableMenu ORDER BY ID ASC"
cocktailsRS.CursorType = 0
cocktailsRS.CursorLocation = 2
cocktailsRS.LockType = 1

cocktailsRS_numRows = 0