Results 1 to 4 of 4

Thread: SQL Syntax Error Help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Greenville
    Posts
    73
    Doews Anybody see what the syntax error is in this::::::

    strquery = ("SELECT * FROM RepoInventory WHERE repoinventory.RepoStatusID = " & "'" & 23 & "'" & "And RepoInventory.AccountTypeID = " & "'" & 4 & "'")

    Thanks

  2. #2
    Hyperactive Member JazzBass's Avatar
    Join Date
    Jun 1999
    Posts
    393

    Don't think you need quotes around the numbers

    Hey VB,
    I don't think you need the quotes around your numbers. If you table is setup with those fields as integers( long, single, whatever) you cannt use quotes. Use quotes only for text.

    In issence, your query should look something like this:
    strquery = ("SELECT * FROM RepoInventory WHERE repoinventory.RepoStatusID = " & 23 & "And RepoInventory.AccountTypeID = " & 4)

    That may be wrong, but it should be close. You may need the "%" sign in there before and after your numbers.

    If you do a search using "SQL" under Database Development, you should find something.

    Let us know
    JazzBass
    JazzBass
    In the .NET era
    Trying to remember VB6
    Progress:
    XP Professional @ Home
    and @ the Office

  3. #3
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    "%" (or "*" depending on the DBMS) are only used with "LIKE" statements. Equality conditions expect the value to match exactly.

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Also in this case he is using hard coded numbers, so the SQL statement could be like this:


    SELECT * FROM RepoInventory WHERE repoinventory.RepoStatusID = 23 And RepoInventory.AccountTypeID = 4"

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