Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CJ CJ is offline
external usenet poster
 
Posts: 102
Default How can I add a table from a different DB to excel Query 2002?

Hi Folks! Spent much time looking for a solution. I need to add a table to an
existing excel query, but it is coming from a different database.

I have a foxpro database call it xx.dbf the table I need is not witihin the
same container, but it is related. Within my current query how can I add a
new table from another DB. I have a named a DSN for the other data source,
but cannot seem to find the correct syntax, or am I asking excel to do too
much.

Any words of wisdom would be greatly appreciated.

Thanks

CJ
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default How can I add a table from a different DB to excel Query 2002?

You may be asking too much from MSQuery. I know of no way to have more than
one data source (DSN) open in MSQuery and, in general, this is a tricky
feature to support so a simple tool like MSQuery may not implement the
capability to do it.

3 possible ways to work around this:
1) bring the 2nd table in via a 2nd query in Excel and use Excel formulas to
relate the two sets of data - if possible.
2) Code a routine that uses ADO, open the two connections to read and
combine the info from your two data sources and output it to the worksheet.
3) Use something like MS Access as an intermediate step: link the two tables
in Access and write your query there. You may need to make a temporary table
with the results since I am not sure if MSQuery can read a linked table
directly out of Access. You can even automate this part through an Excel VBA
sub.

None of these are particularly easy, but they are all I can think of to
solve your problem - maybe someone else knows more and has a better solution.
--
- K Dales


"CJ" wrote:

Hi Folks! Spent much time looking for a solution. I need to add a table to an
existing excel query, but it is coming from a different database.

I have a foxpro database call it xx.dbf the table I need is not witihin the
same container, but it is related. Within my current query how can I add a
new table from another DB. I have a named a DSN for the other data source,
but cannot seem to find the correct syntax, or am I asking excel to do too
much.

Any words of wisdom would be greatly appreciated.

Thanks

CJ

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default How can I add a table from a different DB to excel Query 2002?

CJ,

I agree with K Dales, MSQuery will not really help there.
Succesfully combining data from different databases within a query
depends on the actual driver used.
For e.g. the Jet engine (which is used for everything from
excel/access/dbase and more) the following trick works:

SELECT tblAddresses.*
FROM tblPeople INNER JOIN [C:\Data.mdb].tblAddresses ON
tblPeople.PersonID =
tblAddresses.PersonID

I would advise experimenting with drivers and synatx to see if you can
get it working for dbase/foxpro files.

Dm Unseen

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
Excel 2002, MS Query and MSSQL View with periods John T in MD Excel Discussion (Misc queries) 0 March 14th 07 02:06 PM
Microsoft Query is lost when opening Excel 2002 file dlb Excel Discussion (Misc queries) 0 January 24th 07 12:29 AM
Specifying table in Excel 2002 web queries claytorm Excel Discussion (Misc queries) 0 July 31st 06 03:37 PM
Web Query Doesn't Return All Tables With Excel 2002 Bill Excel Programming 0 February 22nd 05 03:41 PM
Linking a table in Access to a table in Excel using MS Query Diana[_5_] Excel Programming 1 January 16th 04 09:43 PM


All times are GMT +1. The time now is 01:58 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"