Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Using cell values in SQL (MS Query)

Hi,

Is there an easy way to use cell (or range) values in an MS Query SQL
- e.g. [select * from table where id = Cell("E4")]. TIA.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Using cell values in SQL (MS Query)

Add a prompt to your query so that it becomes parameterized.

select * from table where id = ?

Now exit the query and return to XL. If you select Data - Import External
Data - Parameters you will be able to assign the parameter to a cell.
--
HTH...

Jim Thomlinson


"Arshavir Grigorian" wrote:

Hi,

Is there an easy way to use cell (or range) values in an MS Query SQL
- e.g. [select * from table where id = Cell("E4")]. TIA.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Using cell values in SQL (MS Query)

Thanks. A couple of issues:

1) Can't do [ ... WHERE col IN (?)] Only allows single values.

2) Can't have a parameter in a query that can't be displayed
graphically.

Are these for real?



On Feb 21, 8:51*am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
Add a prompt to your query so that it becomes parameterized.

select * from table where id = ?

Now exit the query and return to XL. If you select Data - Import External
Data - Parameters you will be able to assign the parameter to a cell.
--
HTH...

Jim Thomlinson



"Arshavir Grigorian" wrote:
Hi,


Is there an easy way to use cell (or range) values in an MS Query SQL
- e.g. [select * from table where id = Cell("E4")]. TIA.- Hide quoted text -


- Show quoted text -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Using cell values in SQL (MS Query)

They are limitations of that approach. If you need more flexibility you
could use ADO directly.

Tim


"Arshavir Grigorian" wrote in message
...
Thanks. A couple of issues:

1) Can't do [ ... WHERE col IN (?)] Only allows single values.

2) Can't have a parameter in a query that can't be displayed
graphically.

Are these for real?



On Feb 21, 8:51 am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
Add a prompt to your query so that it becomes parameterized.

select * from table where id = ?

Now exit the query and return to XL. If you select Data - Import External
Data - Parameters you will be able to assign the parameter to a cell.
--
HTH...

Jim Thomlinson



"Arshavir Grigorian" wrote:
Hi,


Is there an easy way to use cell (or range) values in an MS Query SQL
- e.g. [select * from table where id = Cell("E4")]. TIA.- Hide quoted
text -


- Show quoted text -



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default Using cell values in SQL (MS Query)

When you are editing the query using the interface (not the wizard)
use square brackets with a space in between to create parameters.
These will enter the ?s in the SQL statement while the interface
writes SQL for you.

When you return to Excel, you'll be prompted for the parameters. You
can choose ranges (cells) for the parameters and tell it whether to
always look there for each parameter.

Cliff Edwards
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 to take values from Cells Keith Excel Discussion (Misc queries) 1 July 11th 08 11:14 AM
Take values for Query from Sheet Keith Excel Discussion (Misc queries) 0 July 10th 08 03:30 PM
Query linked cell values i_am_wookiee Excel Worksheet Functions 0 February 22nd 08 12:11 AM
Using the values in range of cells in an SQL query steveh Excel Programming 3 February 23rd 07 01:45 AM
Importing Data via Web Query - Can values be passed to query? [email protected] Excel Discussion (Misc queries) 5 May 9th 06 06:21 PM


All times are GMT +1. The time now is 04:46 PM.

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

About Us

"It's about Microsoft Excel"