Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

macro  input box

Posted on 2013-10-27
2
Medium Priority
?
292 Views
Last Modified: 2013-10-28
Folks

the below is code that allows me to input the exact sql query I want to parse in excel from my oracle db

 strSQL = InputBox(Prompt:="Your required result set.", _
          Title:="ENTER YOUR QUERY", Default:="Your Query here")

        If strSQL = "Your query here" Or _
           strSQL = vbNullString Then

however I want to hardcode the first part of the query and only want the where clause contained in the input box

i.e.  "select * from tablename " is fixed and non editable, I do want the where clause to be editable so basically have it like so:

select * from tablename where   + strSQL

strSQL = InputBox(Prompt:="Your where clause.", _
          Title:="ENTER YOUR WHERECLAUSE", Default:="Your where clause here")

        If strSQL = "Your where clause" Or _
           strSQL = vbNullString Then

How do I do this?

cheers
0
Comment
Question by:rutgermons
2 Comments
 
LVL 28

Accepted Solution

by:
MacroShadow earned 2000 total points
ID: 39604410
strSQL = yourSQL & InputBox(Prompt:="Your where clause.", _
          Title:="ENTER YOUR WHERECLAUSE", Default:="Your where clause here")
 If strSQL = "Your where clause" Or _
           strSQL = vbNullString Then
0
 
LVL 53

Expert Comment

by:Rgonzo1971
ID: 39604887
Hi

@MacroShadow

in your code strSql cannot be null, I've also corrected the test for the default value

pls try
strResult = InputBox(Prompt:="Your where clause.", _
          Title:="ENTER YOUR WHERECLAUSE", Default:="Your where clause here")
 If strResult = "Your where clause here" Or _
           strResult = vbNullString Then
...
strSQL = yourSQL & strResult 
 

Open in new window

Regards
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question