Toad World® Forums

SQL Query Inputbox problem


#1

Hi All

I have a small problem that I am hoping someone will be able to shed some light on. We have a Excel spredsheet, that contains lots of rows of data, I have tried to get it moved to Access, but they want to keep the spreadsheet. So, basically all I need is for a box to pop up and ask the user to input a product name or part of the product name, finds that row and then uses the data to create the report. I am new to SQL so please forgive the crudiness of the code below, when I run the query I always get an error of not enough of parameters, any ideas.

SELECT Data.Revision
, Data.Description
, Data.Name
, Data.Site
, Data.Location
where Name.DAS = inputbox([Enter Name])
FROM C:\Public\DAS.xls.Data Data


#2

One way would be to create the SQL in Excel with a parameter. Use the “Import External Data --> New Database query”. Choose a data source and add your columns. On the filter data page select the column and option and enter a “?”. This is the symbol for an unnamed parameter. Click through to the end. When it is executing it will ask you to enter a parameter value. To refresh use the red bang and it will ask again for a new parameter.

Debbie
FilterData.jpeg


#3

Thank you for the reply, I did what you suggested but it didn’t ask for me to eneter a paramater, here is the SQL statement

SELECT Data_List.SystemID, Data_List.Revision, Data_List.Name, Data_List.Description, Data_List.Site, Data_List.Location
FROM C:\Public\DAS Live.Data_List Data_List
WHERE (Data_List.Name>’?’)


#4

You shouldn’t quote the ? as you are doing in your example.

/Mauritz


#5

Removed the quote and it ask for a paramater, after entering the paramater it does not extract the signle record


#6

Yeah, but ‘?’ means a string containing a question mark while as ? by itself is a parameter. So if you want Toad to ask you for its value don’t quote it.

/Mauritz


#7

Yep sorry I miss understood, removed qoute and it does ask for the paramater, howerver after entering the paramater it does not extract the single row


#8

Hmm, and it does work when you enter the value by hand in the query?

/Mauritz


#9

Yep, I run the query and with the full name and it brings back lots of rows and not just one specific row