Hi all,
at the moment, I have quite a few separate files which are used to bring back roughly the same data from a SQL database, but the SQL is slightly different on each file (basically different query parameter(s) on each file).
I'd like to consolidate these and create a userform to streamline this. I've created a rough design here: http://i.imgur.com/OAiCoLD.jpg
Not having extensive experience with userforms before, I have a few questions:
1. I'd like each tab to run a different SQL query, passing anything in the TextBox as parameters, then output to a specific sheet. Is this possible?
2. With my current files which just use the Excel parameters when refreshing, I use BETWEEN in the SQL (i.e. where WaveNum BETWEEN ? AND ?). If I just had one WaveNumber data to print off, I would enter in the same number for both parameters. Would it be easier to basically have each tab just use a single SQL statement (i.e. BETWEEN ? AND ?), and if a number is entered into the "single" box, it uses that for both BETWEEN parameters, and if numbers are entered in both the between TextBoxes, use that for parameter1 and 2? Or could/should I use a separate SQL statement (i.e. WaveNum = ? + WaveNum BETWEEN ? AND ?) for each box? Not sure which would be easier.
Finally, of course I'm going to try and look into this myself, but if anyone has any suggested reading material on hand to get the passing of the TextBox into the SQL code, that would be much appreciated.
Thanks.
at the moment, I have quite a few separate files which are used to bring back roughly the same data from a SQL database, but the SQL is slightly different on each file (basically different query parameter(s) on each file).
I'd like to consolidate these and create a userform to streamline this. I've created a rough design here: http://i.imgur.com/OAiCoLD.jpg
Not having extensive experience with userforms before, I have a few questions:
1. I'd like each tab to run a different SQL query, passing anything in the TextBox as parameters, then output to a specific sheet. Is this possible?
2. With my current files which just use the Excel parameters when refreshing, I use BETWEEN in the SQL (i.e. where WaveNum BETWEEN ? AND ?). If I just had one WaveNumber data to print off, I would enter in the same number for both parameters. Would it be easier to basically have each tab just use a single SQL statement (i.e. BETWEEN ? AND ?), and if a number is entered into the "single" box, it uses that for both BETWEEN parameters, and if numbers are entered in both the between TextBoxes, use that for parameter1 and 2? Or could/should I use a separate SQL statement (i.e. WaveNum = ? + WaveNum BETWEEN ? AND ?) for each box? Not sure which would be easier.
Finally, of course I'm going to try and look into this myself, but if anyone has any suggested reading material on hand to get the passing of the TextBox into the SQL code, that would be much appreciated.
Thanks.