Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default how do I add paramters / criteria in the excel query?

I have created an ODBC link to upfdate excel from Oracle. I ned to know how
do I add paramteres in the query so that the user enters the paramter. '@' in
the query throws an error
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default how do I add paramters / criteria in the excel query?

I assume you set up the ODBC link using MSQuery? Setting up parameters is
pretty easy, and you have 3 choices when you do: Use a fixed value (prob not
of interest for you here!), prompt user at time query updates, or use a cell
value from your spreadsheet.
In MSQuery: parameters are indicated by using a name within square braces,
[], within the criteria grid. For example, using a data column for the
selection criteria I could type in the grid the following:
Between [Start date] and [End date]
Now if I refresh the query inside MSQuery, it will prompt me for Start date
and End date. It will also prompt when you return the data to Excel - don't
worry about the values at this point, you can use anything because later you
will set up the values in Excel.
Back in Excel now, right-click somewhere within the result range of the
query. The popup menu should have an option for "Parameters..." and when you
select this you will see a dialog come up. Your parameters (Start date and
End date in my example) will be listed and when you click on one to select it
you can choose how to supply the value (the 3 choices I mentioned above -
fixed value, prompt at runtime, or use a cell value - you specify which cell
from within this dialog).
That should do it, I hope.

BTW: '@' does not work since ODBC needs to use SQL to send the query command
to your database, so you cannot use all the native database conventions, only
SQL. But setting up the query as above builds the SQL for you automatically
so you don't need to worry about syntax.
--
- K Dales


"Mary" wrote:

I have created an ODBC link to upfdate excel from Oracle. I ned to know how
do I add paramteres in the query so that the user enters the paramter. '@' in
the query throws an error

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default how do I add paramters / criteria in the excel query?

Hi Dales,
Thank you very much for your detailed reply.
that was a good help. I needed to prune my query from Pl/SQL to native SQL.
Also, I guess since the query was a big one with severeal tables and views,
MS Query wasnt able to represent it graphically, and thus not allow
parameters.
thanks again

Mary

"K Dales" wrote:

I assume you set up the ODBC link using MSQuery? Setting up parameters is
pretty easy, and you have 3 choices when you do: Use a fixed value (prob not
of interest for you here!), prompt user at time query updates, or use a cell
value from your spreadsheet.
In MSQuery: parameters are indicated by using a name within square braces,
[], within the criteria grid. For example, using a data column for the
selection criteria I could type in the grid the following:
Between [Start date] and [End date]
Now if I refresh the query inside MSQuery, it will prompt me for Start date
and End date. It will also prompt when you return the data to Excel - don't
worry about the values at this point, you can use anything because later you
will set up the values in Excel.
Back in Excel now, right-click somewhere within the result range of the
query. The popup menu should have an option for "Parameters..." and when you
select this you will see a dialog come up. Your parameters (Start date and
End date in my example) will be listed and when you click on one to select it
you can choose how to supply the value (the 3 choices I mentioned above -
fixed value, prompt at runtime, or use a cell value - you specify which cell
from within this dialog).
That should do it, I hope.

BTW: '@' does not work since ODBC needs to use SQL to send the query command
to your database, so you cannot use all the native database conventions, only
SQL. But setting up the query as above builds the SQL for you automatically
so you don't need to worry about syntax.
--
- K Dales


"Mary" wrote:

I have created an ODBC link to upfdate excel from Oracle. I ned to know how
do I add paramteres in the query so that the user enters the paramter. '@' in
the query throws an error

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query criteria from Excel workbook Ken King Excel Discussion (Misc queries) 2 February 23rd 09 05:03 PM
Convert hard coded query criteria to Parameter Query Melanie[_2_] Excel Discussion (Misc queries) 0 July 15th 08 09:59 PM
Database query with a range of cells as paramters? heprox Excel Discussion (Misc queries) 0 January 18th 07 11:15 PM
Using A Cell In Excel as Criteria for a Query charles Excel Discussion (Misc queries) 2 July 14th 06 05:06 PM
Parsing paramters Mark[_36_] Excel Programming 3 February 9th 04 05:03 PM


All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"