Access LIMIT Query Problems

Discussion in 'C#' started by stickman373, Jul 20, 2005.

  1. #1
    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?
     
    stickman373, Jul 20, 2005 IP
  2. Perrow

    Perrow Well-Known Member

    Messages:
    1,306
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    140
    #2
    What happens if you take the ORDER BY part off?
     
    Perrow, Jul 20, 2005 IP
  3. dct

    dct Finder of cool gadgets

    Messages:
    3,132
    Likes Received:
    328
    Best Answers:
    0
    Trophy Points:
    230
    #3
    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
     
    dct, Jul 20, 2005 IP
  4. stickman373

    stickman373 Peon

    Messages:
    331
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thanks, the TOP 5 worked :) Was wondering if it had the limit query
     
    stickman373, Jul 20, 2005 IP
  5. Perrow

    Perrow Well-Known Member

    Messages:
    1,306
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    140
    #5
    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.
     
    Perrow, Jul 20, 2005 IP
  6. sscheral

    sscheral Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    No LIMIT key word found in MS Access
     
    sscheral, Jul 24, 2008 IP