+ Reply to Thread
Results 1 to 6 of 6

Multiple Values in same parameter

  1. #1
    Registered User
    Join Date
    03-17-2014
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2013
    Posts
    16

    Multiple Values in same parameter

    Hello there,

    I'm trying to run a query from a sql external data, in which i can can choose multiple values. I've tried to edit MS Query in order to choose only the values that i want, but it seems there's a limit to how many criteria can be add in on conditional.

    I've also tried to proceed as explained in the link above, with no luck.

    http://datapigtechnologies.com/blog/...one-parameter/



    I'm trying to add 45 values to the same parameter, diferenced by ",".

    Can you help?

    Thank you, and sorry for my english.

  2. #2
    Registered User
    Join Date
    03-17-2014
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Multiple Values in same parameter

    Here is the code:


    SELECT Test."Date 1", Test."Date 2", Test."Date 3", Test."Date 4", Test.Segmento, Test."Id Value", Test."ID", Test."User", Test.City FROM Leftover.Test Test WHERE (Test."Date 4">=? And Test."Date 4"<=?) AND (Test."ID" = ?)

    Parameter 1 - "A1" - Date Value
    Parameter 2 - "A2" - Data Value
    Parameter 3 - "A3" - Multiple Values(ID452, ID359, ID101, ID789, ID7855, ID124, ID987)

  3. #3
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,178

    Re: Multiple Values in same parameter

    This is what a table is for. Build a table of items you want to search, join it to the data table.
    boom. multiple params.

  4. #4
    Registered User
    Join Date
    03-17-2014
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Multiple Values in same parameter

    Thanks for the reply ranman, but i guess i didn't explained well. I can put it to work with parameters just fine. the issue is when i try to insert more than one value in the same parameter.

  5. #5
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,178

    Re: Multiple Values in same parameter

    Exactly. Use a joined table.

  6. #6
    Registered User
    Join Date
    03-17-2014
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Multiple Values in same parameter

    Using a joined table, the query will only show the data a inserted? Didn't know that. Can i join with Excel Sheet or do it with a Excel Table? I don't can't edit in the sql server, because our client refuses to share the acess to edit.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 10-06-2014, 08:15 AM
  2. Replies: 0
    Last Post: 10-06-2014, 07:35 AM
  3. Replies: 0
    Last Post: 11-12-2013, 03:57 AM
  4. [SOLVED] VBA Query that passes a parameter with multiple values
    By tlittell in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-25-2013, 09:18 AM
  5. [SOLVED] parameter has multiple values seperated by value
    By sbale in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-10-2005, 11:05 AM

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