Link to home
Start Free TrialLog in
Avatar of rutgermons
rutgermons

asked on

macro input box

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
ASKER CERTIFIED SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rgonzo1971
Rgonzo1971

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