Millsberry - Deaf Topics - Find jobs - Free online video sharing India - Debt Consolidation

PDA

View Full Version : Access LIMIT Query Problems


stickman373
Jul 20th 2005, 7:23 am
strSQL = "SELECT * FROM Table1 WHERE expire_date>#" & dteDate & "# ORDER BY post_date DESC LIMIT 3;"

If I take the LIMIT part off, it works, but add it on and it causes:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in ORDER BY clause.

/mghdevelopment/index1.asp, line 463


Any ideas?

Perrow
Jul 20th 2005, 7:26 am
strSQL = "SELECT * FROM Table1 WHERE expire_date>#" & dteDate & "# ORDER BY post_date DESC LIMIT 3;"

If I take the LIMIT part off, it works, but add it on and it causes:
What happens if you take the ORDER BY part off?

dct
Jul 20th 2005, 7:27 am
I don't think Access has a limit keyword, you may be able to use TOP after the select keword e.g. select Top 5 * from .... that's how it works in MS SQL Server

stickman373
Jul 20th 2005, 7:32 am
I don't think Access has a limit keyword, you may be able to use TOP after the select keword e.g. select Top 5 * from .... that's how it works in MS SQL Server

thanks, the TOP 5 worked :) Was wondering if it had the limit query

Perrow
Jul 20th 2005, 7:34 am
I don't think Access has a limit keyword, you may be able to use TOP after the select keword e.g. select Top 5 * from .... that's how it works in MS SQL Server
I knew I figured it out recently, but had another problem that made me remove it so I had no place to look it up. Hope that solves the problem.

sscheral
Jul 24th 2008, 3:50 am
No LIMIT key word found in MS Access