Forums

This topic is locked

filter with last 5 id's

Posted 01 Apr 2002 19:51:33
1
has voted
01 Apr 2002 19:51:33 Dave Clarke posted:
hi
i am trying to create a recordset containing the last 5 records inserted in the db.
I can filter with the ID descending but how do i limit it to 5 records?
thanks
Dave

Replies

Replied 01 Apr 2002 20:10:23
01 Apr 2002 20:10:23 Owen Eastwick replied:
Try:

SELECT TOP 5 FROM TableName
ORDER BY RecordID DESC

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 01 Apr 2002 20:22:40
01 Apr 2002 20:22:40 Dave Clarke replied:
OMG, Is it really as easy as that?
How dumb am I? (rhetorical)
Thanks
Dave


<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Try:

SELECT TOP 5 FROM TableName
ORDER BY RecordID DESC

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 01 Apr 2002 20:56:32
01 Apr 2002 20:56:32 Dave Clarke replied:
tried it and it don't work

"the SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is wrong"

thanks anyway

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Try:

SELECT TOP 5 FROM TableName
ORDER BY RecordID DESC

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 01 Apr 2002 21:45:27
01 Apr 2002 21:45:27 Jeremy Conn replied:
You could use the 'Repeat Region' server behavior that is default with UD, and just select 5 results.

(UD4|IIS5|WXP|ASP)
*Connman21*
www.conncreativemedia.com
Replied 01 Apr 2002 21:49:13
01 Apr 2002 21:49:13 Dave Clarke replied:
Yes thanks
I have done that but didn't like it. I would prefer to have just one record at a time and have the user navigate through the records.
Dave

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
You could use the 'Repeat Region' server behavior that is default with UD, and just select 5 results.

(UD4|IIS5|WXP|ASP)
*Connman21*
www.conncreativemedia.com
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 01 Apr 2002 22:23:33
01 Apr 2002 22:23:33 Jean-Marie Bonnar replied:
Hi Dave,

Try the following syntax and remember to put a space between your number and the *


SELECT TOP 5 * FROM TableName
ORDER BY RecordID DESC

Regards,

Jean-Marie
Replied 01 Apr 2002 23:06:38
01 Apr 2002 23:06:38 Owen Eastwick replied:
Oops! <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

Thanks Jean-Marie.

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 02 Apr 2002 00:09:44
02 Apr 2002 00:09:44 Jean-Marie Bonnar replied:
You're welcome Owen. <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> I learned that from you, you know??? lol

Regards,

Jean-Marie
Replied 02 Apr 2002 11:57:01
02 Apr 2002 11:57:01 Dave Clarke replied:
thanks guys

not tried the * in it yet but will do.

Dave

Reply to this topic