Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generate a report from SQL to Excel using a ListBox

Status
Not open for further replies.

Latoya

IS-IT--Management
May 17, 2017
11
US
Hi-

I am pulling a report from SQL in Excel. I got it all working, except I need multiple user prompts (one parameter with multiple values).

So I decided to use a listbox which contains all the possible selection that I want the user to choose from (These values are on another sheet in the same workbook) and then when a button is clicked, it displays the information in that same worksheet base on the selected choices the user choose.

This information that is being displayed is coming straight from SQL.

I tried using a userform in VBA in Excel, but I am still not quite sure how to have it pull from SQL base on the selections in the listbox.

I had it where the information was displayed, except I was only able to input one parameter at a time. I want the user to be able to do multiple selections and then the information is displayed.

In my query I had wmav_code = ? to prompt the user to input what code they wanted, bus as stated before, its just one. I tried wmav_code in (?,?,?,?), however, that's limiting the prompts to 4. I have 97 various codes to choose from (Hence the decision to use a listbox).

I tried (InStr(?, [wmav_code])>0), but Excel 2016 does not recognize that function (InStr()).

P.S. These are all within the 'WHERE' clause.

Any help is appreciated!!! :)

Thank you!
 
Hi,

This is an MS Excel question, not a MySQL question. This question is related to how Excel handles Parameters in MS Query. It normally would be best addressed in forum68.

HOWEVER, since this requirement exceeds Excel's query parameter features, it would be better to post your qustion in forum707, since it will requite custom VBA macro code.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top