Results 1 to 2 of 2

Thread: Invalid procedure call or argument: 'Left'

  1. #1
    Join Date
    Jan 2004
    Posts
    9

    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 & ")"

  2. #2
    Join Date
    Feb 2002
    Location
    Campbellsport, Wisconsin
    Posts
    1,989
    This can happen if strInList is 0 characters in length...

    If Len(strInList) > 1) Then
    strInList = Left(strInList, len(strInList)-1)
    End if

    Idealy, I would check for physical location...

    Mypos = InStrRev(strInList, ",")
    If MyPos > 0 Then
    strInList = Left(strInList, MyPos-len(strInList))
    sql = "SELECT * FROM logbook WHERE cusine IN (" & strInList & ")"
    Else 'There is no selection
    sql = "SELECT * FROM logbook"
    End If

    You could look at using Trim to remove any unwanted spaces...

    Dim MyVar
    MyVar = LTrim(" vbscript ") ' MyVar contains "vbscript ".
    MyVar = RTrim(" vbscript ") ' MyVar contains " vbscript".
    MyVar = Trim(" vbscript ") ' MyVar contains "vbscript".

Bookmarks

Posting Permissions

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