Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Mar 2003
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Invalid procedure call or argument: 'Left'

    Microsoft VBScript runtime error '800a0005'
    Invalid procedure call or argument: 'Left' at the line:
    strInList = Left(strInList, len(strInList)-1)

    any ideas?

    Dim arrCuisines, strInList

    arrCuisines = array("AFRICAN","CARIBBEAN","CHINESE","CONTINENTAL",....")

    For each cuisine In arrCuisines
    If Request.Form(cuisine) = "true" Then
    strInList = strInList & "'" & cuisine & "',"
    End If
    Next

    strInList = Left(strInList, len(strInList)-1)

    sql = "SELECT * FROM logbook WHERE cusine IN (" & strInList & ")"
    Last edited by havey; 01-14-2004 at 08:58 AM.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Why not just use Join()?

    strInList = Join(arrCuisines, "','")
    sql = "SELECT * FROM logbook cusine IN ('" & strInList & "')"

    The reason you're getting the error is probably the variable strInList is empty (the request.form condition evaluated to false) which make the call to Left() like this:

    strInList = Left("", -1)

    obviously a less than zero length is invalid.
    Last edited by glenngv; 01-14-2004 at 09:03 AM.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    glenngv,

    I'd bet that is what the error is coming from.

    I noticed that you are checking if the form element in the variable name cuisine is being evaluated, is it supposed to have quotes or actually be a variable.
    OracleGuy

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    The quoted "true" is correct. Values retrieved from Request collections are all strings.

    Analyzing the code again, I think my suggestion of using Join() was wrong. Here's the correct code:
    Code:
    arrCuisines = array("AFRICAN","CARIBBEAN","CHINESE","CONTINENTAL", "....")
    
    For each cuisine In arrCuisines
      If Request.Form(cuisine) = "true" Then
        strInList = strInList & "'" & cuisine & "',"
      End If
    Next
    
    if strInList<>"" then
      strInList = Left(strInList, len(strInList)-1)
      sql = "SELECT * FROM logbook WHERE cusine IN (" & strInList & ")"
    end if
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello
    Any idea, why I am getting this error?:

    (135, 4) Microsoft VBScript runtime error: Invalid procedure call or argument: 'Left'

  • #6
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,930
    Thanks
    46
    Thanked 203 Times in 202 Posts
    @nhaus
    Please post a new thread with the code you need help with. This thread is from 2004 and we have no idea what code you are using.

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

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