Results 1 to 4 of 4

Thread: [RESOLVED] Correct my SQL stt (wait, trying to see in FAQs)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2007
    Posts
    83

    Resolved [RESOLVED] Correct my SQL stt (wait, trying to see in FAQs)

    Can anyone help me correct syntax error(s) in the following code:

    MyRSDetails.Open "SELECT tblClients.ClientCode, tblClients.* FROM tblClients" & _
    "WHERE tblClients.ClientCode = '" & strClientID & "';", conn, adOpenKeyset, adLockOptimistic
    Runtime error : Syntax error in FROM clause.

    Thank u
    Last edited by MintFlavor; Apr 10th, 2007 at 06:11 AM.

  2. #2
    Fanatic Member amrita's Avatar
    Join Date
    Jan 2007
    Location
    Orissa,India
    Posts
    888

    Re: Correct my SQL stt (wait, trying to see in FAQs)

    Code:
    MyRSDetails.Open "SELECT * FROM tblClients" & _
    " WHERE tblClients.ClientCode = '" & strClientID & "'", conn, adOpenKeyset, adLockOptimistic
    Last edited by amrita; Apr 10th, 2007 at 06:21 AM.

  3. #3
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Correct my SQL stt (wait, trying to see in FAQs)

    Yeah - you need a space after the table name.
    Best thing is to put the sql statement into a string variable then you can debug.print it (or breakpoint n check it).

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  4. #4
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: Correct my SQL stt (wait, trying to see in FAQs)

    You need a space between tblClients and WHERE.
    The semicolon is ok but not needed.
    If ClientCode is a numeric field, you'll need to use a numeric variable, not a string.
    Tengo mas preguntas que contestas

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