+ Reply to Thread
Results 1 to 17 of 17

Excel Parameters Help!

  1. #1
    Registered User
    Join Date
    06-01-2015
    Location
    US
    MS-Off Ver
    2013
    Posts
    15

    Excel Parameters Help!

    I have a database getting pulled into excel for ease of information without using the database program. The SQL Code is ready to go, we now just need parameters to narrow down a huge record of results. The first parameter is to get the Company Number, and we need a second parameter to get the invoice number. This is only one sheet of records we are pulling, so knowing this code will go a long way.

    I want it so they can enter the company number, and the results shrink to just info for that number. Then, they can enter an invoice number right next to that parameter cell, and the results will then shrink to just that invoice number. I have yet to figure out a way to get two or more parameters to work tandem together. Below is the code I thought would work, but as of now, its only one or the other:


    WHERE JCCM.Company Like ? AND JCCM.Invoice Like ?

    Please help!

  2. #2
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Excel Parameters Help!

    I don't think you're looking for a partial match on company number or invoice number, so the Like isn't necessary.
    Please Login or Register  to view this content.
    should suffice. Were you forgetting the quotes?

  3. #3
    Registered User
    Join Date
    06-01-2015
    Location
    US
    MS-Off Ver
    2013
    Posts
    15

    Re: Excel Parameters Help!

    Quote Originally Posted by cyiangou View Post
    I don't think you're looking for a partial match on company number or invoice number, so the Like isn't necessary.
    Please Login or Register  to view this content.
    should suffice. Were you forgetting the quotes?
    That doesn't provide a cell parameter though. They aren't going to go into the SQL query every time to change the values.

  4. #4
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Excel Parameters Help!

    Oh ok, I misunderstood. You're using datatables and data binding? Not my area really. I was talking vba-driven unbound data access.

  5. #5
    Registered User
    Join Date
    06-01-2015
    Location
    US
    MS-Off Ver
    2013
    Posts
    15

    Re: Excel Parameters Help!

    Quote Originally Posted by cyiangou View Post
    Oh ok, I misunderstood. You're using datatables and data binding? Not my area really. I was talking vba-driven unbound data access.
    Yeah, a database through MS Query. I'm sorry, I should have mentioned that.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2507 Win 11
    Posts
    24,919

    Re: Excel Parameters Help!

    Check out the Query Manager Add in at this link.

    http://www.jkp-ads.com/download.asp
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  7. #7
    Registered User
    Join Date
    06-01-2015
    Location
    US
    MS-Off Ver
    2013
    Posts
    15

    Re: Excel Parameters Help!

    Quote Originally Posted by alansidman View Post
    Check out the Query Manager Add in at this link.

    http://www.jkp-ads.com/download.asp
    Not able to get to that page due to our network policies.

  8. #8
    Registered User
    Join Date
    06-01-2015
    Location
    US
    MS-Off Ver
    2013
    Posts
    15

    Re: Excel Parameters Help!

    Quote Originally Posted by alansidman View Post
    Check out the Query Manager Add in at this link.

    http://www.jkp-ads.com/download.asp
    Do you have any other options?

  9. #9
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Excel Parameters Help!


  10. #10
    Registered User
    Join Date
    06-01-2015
    Location
    US
    MS-Off Ver
    2013
    Posts
    15

    Re: Excel Parameters Help!

    Quote Originally Posted by cyiangou View Post
    Only helps for single parameters. I need it so when they enter one parameter in a cell, records reduce to that parameter. Then, when they enter another parameter, the results trim even further down.

  11. #11
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Excel Parameters Help!

    Would you entertain a vba method of setting parameters?

  12. #12
    Registered User
    Join Date
    06-01-2015
    Location
    US
    MS-Off Ver
    2013
    Posts
    15

    Re: Excel Parameters Help!

    Quote Originally Posted by cyiangou View Post
    Would you entertain a vba method of setting parameters?
    Absolutely! I would like to try to figure out a solution instead of paying data services thousands of $$.

  13. #13
    Registered User
    Join Date
    06-01-2015
    Location
    US
    MS-Off Ver
    2013
    Posts
    15

    Re: Excel Parameters Help!

    Quote Originally Posted by cyiangou View Post
    Would you entertain a vba method of setting parameters?
    Here is my current code:

    HTML Code: 
    I would like to have a parameter in one cell off to the side of the table for APTD.APCo and another cell with a parameter for APTH.APRef

  14. #14
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Excel Parameters Help!

    No doubt the forum firewall won't let me post SQL directly so here's a bitmap of the code in the ThisWorkbook module:
    msquery.jpg

    You get the idea. I'm sure you'll easily substitute your SQL.

    Here's the workbook also:
    msquery_cy.xlsm

  15. #15
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Excel Parameters Help!

    Although I think you'll be disappointed with your 'honing in' effect. You'll get either:

    All records
    or
    All records matching Company Number
    or
    All records matching Invoice Number
    or
    One record (or set) matching both Company Number and Invoice Number

    But I don't think you will see a smoothly reducing resultset.

  16. #16
    Registered User
    Join Date
    06-01-2015
    Location
    US
    MS-Off Ver
    2013
    Posts
    15

    Re: Excel Parameters Help!

    Quote Originally Posted by cyiangou View Post
    Although I think you'll be disappointed with your 'honing in' effect. You'll get either:

    All records
    or
    All records matching Company Number
    or
    All records matching Invoice Number
    or
    One record (or set) matching both Company Number and Invoice Number

    But I don't think you will see a smoothly reducing resultset.
    Yikes. That looses me a little. Let me add I am not proficient in VBA or SQL lol.

  17. #17
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Excel Parameters Help!

    @xLogan108

    Only helps for single parameters.
    I think you are mistaken, the Mehta example only shows one parameter, but you can add more, then link them to cells, see attachments
    Attached Images Attached Images
    Last edited by WHER; 08-26-2015 at 05:19 PM.

+ 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. Excel Parameters Help!
    By xLogan108 in forum Access Tables & Databases
    Replies: 1
    Last Post: 08-24-2015, 10:41 AM
  2. excel parameters in subquery
    By saharm1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2014, 07:12 PM
  3. Excel query and parameters
    By urbanmojo in forum Excel General
    Replies: 1
    Last Post: 07-23-2007, 12:17 AM
  4. Fetch parameters from web into Excel
    By Jonas B in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-30-2006, 06:15 PM
  5. [SOLVED] How do I pass parameters into Excel from a URL?
    By David Jankowski in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-04-2006, 04:55 PM
  6. Use of Parameters in Excel
    By sarjak in forum Excel General
    Replies: 7
    Last Post: 02-01-2006, 02:45 PM
  7. Parameters in Excel
    By Brandon Williams in forum Excel General
    Replies: 3
    Last Post: 10-18-2005, 09: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