Results 1 to 2 of 2

Thread: My select statement does not work

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    Saudi Arabia, Gulf side, Qatif
    Posts
    142
    When I run this command:

    Private Sub Command7_Click()
    'CRI is the table name
    'stock is the field name
    mySQL = "SELECT * FROM cri WHERE stock Like '[89]*';"
    Data1.RecordSource = mySQL
    Data1.Refresh
    End Sub

    I am getting this error:

    Too few parameters. Expected 1. (Error 3061)
    What could be wrong with it...

    Any help...
    Appreciated in advance

    [Edited by maqmaq on 10-10-2000 at 09:30 AM]

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Location
    Holden Beach NC
    Posts
    85
    Originally posted by maqmaq
    When I run this command:

    Private Sub Command7_Click()
    'CRI is the table name
    'stock is the field name
    mySQL = "SELECT * FROM cri WHERE stock Like '[89]*';"
    Data1.RecordSource = mySQL
    Data1.Refresh
    End Sub

    I am getting this error:

    Too few parameters. Expected 1. (Error 3061)
    What could be wrong with it...

    Any help...
    Appreciated in advance

    [Edited by maqmaq on 10-10-2000 at 09:30 AM]
    I would guess that it is the brackets, but I would suggest changing some other syntax:

    strSQL="SELECT cri.* FROM cri WHERE cri.stock = 89;"

    Unless you have a field named 'stock' that is a text field (WHY?) you cannot use "LIKE" as a comparison. 'LIKE' is a string comparison. Use simple arithmetic operators like "<>=". If you are using a string comparison for a field named "stock" (WHY?) then you should remove the brackets from around it. I think that the error that you are recieving is a type-mismatch error....but I have not looked it up.

    Hope This Helps,

    Hunter

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