Results 1 to 4 of 4

Thread: [RESOLVED] sql problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2006
    Posts
    22

    Resolved [RESOLVED] sql problem

    i am trying to get some records from my database(ms access) using an sql command.
    what is wrong with this?
    adoPrimaryRS.Open "select field3 from 345_POLICY where field3 = " & usermotor & "", db, adOpenStatic, adLockOptimistic
    when i run the program i get the error
    syntax error(missing operator) in query expression 'field3 = 333'.
    please help

  2. #2
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: sql problem

    If field3 is non-numeric then you will have to include apostrophes in your query like this
    VB Code:
    1. adoPrimaryRS.Open "select field3 from 345_POLICY where field3 = '" & usermotor & "'", db, adOpenStatic, adLockOptimistic
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2006
    Posts
    22

    Re: sql problem

    thanks a lot that work!

  4. #4
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: sql problem

    Quote Originally Posted by petros
    thanks a lot that work!
    You are welcome. PLease make sure you mark your thread resolved by opening thread tools at the top of this thread and select Mark Thread Resolved from the Menu.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

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