Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Get External Data Query


I would like to run a query across an external db using a value from a
cell as a restriction in the query.

I would like the query to do something like:

SELECT DCMS.NAME
FROM RXC.DCMS DCMS
WHERE (DCMS.DOMAIN='E$1$')

The query attempts to look only for possible values in the external db.
I need to restrict the name values to only the values which exist in
the domain indicated in cell E1.

I'm guessing I can't do this or will need to do it in the vba editor
rather than query builder?

Can anyone help?

Thanks!!!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default Get External Data Query

You have to variablize the value. I am assuming you are
executing the query as a string query. Do this:

"SELECT DCMS.NAME " _
& "FROM RXC.DCMS DCMS " _
& "WHERE (DCMS.DOMAIN='" _
& Range("A1") _
& "')



-----Original Message-----

I would like to run a query across an external db using a

value from a
cell as a restriction in the query.

I would like the query to do something like:

SELECT DCMS.NAME
FROM RXC.DCMS DCMS
WHERE (DCMS.DOMAIN='E$1$')

The query attempts to look only for possible values in

the external db.
I need to restrict the name values to only the values

which exist in
the domain indicated in cell E1.

I'm guessing I can't do this or will need to do it in the

vba editor
rather than query builder?

Can anyone help?

Thanks!!!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step

guide to creating financial statements
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Get External Data Query

drs

Open the query in MSQuery (from the last page of the query wizard) and
within MSQuery make it a parameter query. To do that, add criteria under
the Domain filed and put it in brackets, like this

[Enter domain]

This will create a prompt when you refresh the query. Now, return to Excel
and on the External Data commandbar, click the parameters button. Here you
can change this from a prompt query to read the value from a cell.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"drs******" wrote in message
...

I would like to run a query across an external db using a value from a
cell as a restriction in the query.

I would like the query to do something like:

SELECT DCMS.NAME
FROM RXC.DCMS DCMS
WHERE (DCMS.DOMAIN='E$1$')

The query attempts to look only for possible values in the external db.
I need to restrict the name values to only the values which exist in
the domain indicated in cell E1.

I'm guessing I can't do this or will need to do it in the vba editor
rather than query builder?

Can anyone help?

Thanks!!!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements


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
How can I find external data query name MarkJC Excel Discussion (Misc queries) 3 December 18th 08 11:09 PM
Import external data - web query Vijay Kotian Excel Discussion (Misc queries) 3 May 15th 07 01:43 PM
External Data Query Marie Bayes Excel Discussion (Misc queries) 4 January 11th 07 06:08 PM
Get External Data-New Web Query saziz Excel Discussion (Misc queries) 1 May 23rd 06 10:22 PM
Query of External Data Excel GuRu Excel Discussion (Misc queries) 2 January 3rd 05 07:43 PM


All times are GMT +1. The time now is 06:21 AM.

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"