Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default if database exists... MS Query

Hello,

I'm trying to pull data from access to excel using MS Query. I have
three Access databases (for three different countries) that will
reside in three seperate subdirectories on the harddrive. I want to
create one excel file that will work for all three applications.
Problem is that the data source is hard coded into the MS Query. Is
there some syntax in SQL that I can use to find the correct data
base?

like,

select table1.* from c:\app1\table1.mdb if exists
else select table1.* from c:\app2\table1.mdb if exists
else select table1.* from c:\app3\table1.mdb.

or something like that.

Thanks!

Dave

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default if database exists... MS Query

hi Dave,
if i understand you, you want 1 MSQ to select from 3 different db tables. If
the dbs are on your hard drive the table1 in first db will always exist and
be selected first always.
I have worked with MSQs a good deal in the past (not recently) and found
that MSQ is not that sophisticated. My suggestion is to have 1 workbook with
3 sheets and 3 MSQs, one for each of your dbs. you could record a macro to
run each one after the other.
my thoughts.

Regards
FSt1

"savalou" wrote:

Hello,

I'm trying to pull data from access to excel using MS Query. I have
three Access databases (for three different countries) that will
reside in three seperate subdirectories on the harddrive. I want to
create one excel file that will work for all three applications.
Problem is that the data source is hard coded into the MS Query. Is
there some syntax in SQL that I can use to find the correct data
base?

like,

select table1.* from c:\app1\table1.mdb if exists
else select table1.* from c:\app2\table1.mdb if exists
else select table1.* from c:\app3\table1.mdb.

or something like that.

Thanks!

Dave


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default if database exists... MS Query

Thanks for responding. I guess I didn't explain it very well; I'd
like one MSQ to select from 3 differerent databases (.mdb). One
computer (in 1 of 3 different countries) would only have one of these
databases, each has it's own subdirectory. (This is an application
for collecting, analysing and reporting HIV/AIDS data.) The excel
workbook is a summary of the data in the database. There are more than
40 MSQs in the workbook which is why I'd like to avoid setting up
three different workbooks. Ideally I'd like the MSQs in the workbook
to look for the existing database (there can be only one of the three
in a given country). Is this doable in SQL?

thanks again,

Dave

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
Import New Database Query (Union Query) in Spreadsheet klock Excel Discussion (Misc queries) 2 September 24th 09 01:30 AM
database query not showing foxpro database How I import data mangat New Users to Excel 1 June 24th 07 03:31 PM
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? jocke Excel Discussion (Misc queries) 1 November 29th 05 01:44 PM
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? jocke Excel Discussion (Misc queries) 0 November 28th 05 06:37 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM


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