+ Reply to Thread
Results 1 to 4 of 4

build param string for WHERE IN (....)

  1. #1

    build param string for WHERE IN (....)

    Hi,
    i'm trying to build a parameter in VBA as a list stings to pass it to
    MSAccess procedure such as
    "select ...from ...WHERE Strategy in ([@Strategy_List]);"

    but I'm having problem with quotation marks around each string in a
    list.. if only one name is in the list then query works just find but
    additing second string to the list breaks it...


    Set ParamStrategy = .CreateParameter("@Strategy_List", adVariant,
    adParamInput)
    'this one will work as only one string in the list
    ParamStrategy.Value = "ALL_STRT"
    param with two strings fails
    'ParamStrategy.Value = "" & """ALL_G""" & "," & """ALL_O""" & ""

    would appreciate any help on it
    cheers
    D.


  2. #2
    Tom Ogilvy
    Guest

    Re: build param string for WHERE IN (....)

    See this:

    http://www.dbforums.com/showthread.p...65#post4447965

    --
    Regards,
    Tom Ogilvy



    <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    > i'm trying to build a parameter in VBA as a list stings to pass it to
    > MSAccess procedure such as
    > "select ...from ...WHERE Strategy in ([@Strategy_List]);"
    >
    > but I'm having problem with quotation marks around each string in a
    > list.. if only one name is in the list then query works just find but
    > additing second string to the list breaks it...
    >
    >
    > Set ParamStrategy = .CreateParameter("@Strategy_List", adVariant,
    > adParamInput)
    > 'this one will work as only one string in the list
    > ParamStrategy.Value = "ALL_STRT"
    > param with two strings fails
    > 'ParamStrategy.Value = "" & """ALL_G""" & "," & """ALL_O""" & ""
    >
    > would appreciate any help on it
    > cheers
    > D.
    >




  3. #3

    Re: build param string for WHERE IN (....)

    Tom, thank U for the response but the problem mentioned in the posting
    (through the link U provided) is different from mine: i'm sending one
    parameter which contains a list of strings (not a list of parameters)
    but in the example from your link is an attempt to append parameter to
    another parameter ...
    well, at least as I'm interpreting my issue..
    cheers
    D.


  4. #4
    Tom Ogilvy
    Guest

    Re: build param string for WHERE IN (....)

    Sounds to me like you either need a single string that has a list of comma
    separated words in it

    "red,blue,green"

    or you need an array (if the parameter will accept an array).

    --
    Regards
    Tom Ogilvy

    <[email protected]> wrote in message
    news:[email protected]...
    > Tom, thank U for the response but the problem mentioned in the posting
    > (through the link U provided) is different from mine: i'm sending one
    > parameter which contains a list of strings (not a list of parameters)
    > but in the example from your link is an attempt to append parameter to
    > another parameter ...
    > well, at least as I'm interpreting my issue..
    > cheers
    > D.
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1