Results 1 to 4 of 4

Thread: [RESOLVED] Syntax error in FROM Clause

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Location
    Best Place on Earth
    Posts
    363

    Resolved [RESOLVED] Syntax error in FROM Clause

    I have an Access 2003 database which has a link to table dbo_StandingSettelmentInstructionSearch

    I am using ADO to access the data.

    The below works fine.
    Code:
       SQLStr = "dbo_StandingSettlementInstructionSearch where ChangeState = 9"
        Set TheConn = CurrentProject.Connection
        Set TheRS = New ADODB.Recordset
        TheRS.Open SQLStr, TheConn, adOpenKeyset, adLockPessimistic, adCmdTable
    However when I change the SQLStr string to

    Code:
    "select oid, Country from dbo_StandingSettlementInstructionSearch where ChangeState = 9"
    I get an error message saying

    Run-Time Error '-2147217900 (80040e14)'
    Syntax Error in the FROM Clause.

    Can anyone offer any insight as to why this might be.

    Please notem in case it might be to do with the table name length, I have
    created a Query to reduce the table name but still got the same error.
    Signature Under Construction

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Syntax error in FROM Clause

    Try changing the underscore (dbo_) to a period (dbo.)
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Syntax error in FROM Clause

    did you change the command type?

    Code:
    TheRS.Open SQLStr, TheConn, adOpenKeyset, adLockPessimistic, adCmdTable
    When you changed it to a select, it no longer becomes a table... but text..
    Code:
    TheRS.Open SQLStr, TheConn, adOpenKeyset, adLockPessimistic, adCmdText
    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Location
    Best Place on Earth
    Posts
    363

    Re: Syntax error in FROM Clause

    Hi Gary,

    The Underscore is actually a part of the Table Name

    Hi techgnome,

    I changed the command type to adCmdText and it worked.

    Many Thanks.
    Signature Under Construction

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width