PC Review


Reply
Thread Tools Rate Thread

Change SELECT FROM When Using Excel to Query Excel

 
 
=?Utf-8?B?QmFnbG9n?=
Guest
Posts: n/a
 
      11th Sep 2007
Hi Everyone,

I am creating an excel workbook that I would like to distribute to others.
This workbook uses another excel workbook as the data source. Currently, the
select statement looks like this:

SELECT [everything$].ID, [everything$].UID, ...
FROM `C:\path\export`.[everything$] [everything$]

What I would like to accomplish is remove the "C:\path" part and have the
query look for the data store in the same directory as the workbook. This
should allow me to zip up the file and the data store and distribute it to
others with the instructions to just overwrite the the data store with more
current information.

I have changed the FROM line to read:
FROM `export`.[everything$] [everything$]

and I get an error: Could not add the table '`export`.[everything$]'.

Is there a graceful way to accomplish this? My backup plan is to just force
the users to use a hard-coded directory (small user community), but I'd like
to shoot for something a little bit more flexible.

Thanks in advance!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?YmFybmFiZWw=?=
Guest
Posts: n/a
 
      11th Sep 2007
concatenate in the path from the activeworkbook. Something like :

SELECT [everything$].ID, [everything$].UID, ...
FROM `" & activeworkbook.path & "\`.[everything$] [everything$]

Peter Richardson

"Baglog" wrote:

> Hi Everyone,
>
> I am creating an excel workbook that I would like to distribute to others.
> This workbook uses another excel workbook as the data source. Currently, the
> select statement looks like this:
>
> SELECT [everything$].ID, [everything$].UID, ...
> FROM `C:\path\export`.[everything$] [everything$]
>
> What I would like to accomplish is remove the "C:\path" part and have the
> query look for the data store in the same directory as the workbook. This
> should allow me to zip up the file and the data store and distribute it to
> others with the instructions to just overwrite the the data store with more
> current information.
>
> I have changed the FROM line to read:
> FROM `export`.[everything$] [everything$]
>
> and I get an error: Could not add the table '`export`.[everything$]'.
>
> Is there a graceful way to accomplish this? My backup plan is to just force
> the users to use a hard-coded directory (small user community), but I'd like
> to shoot for something a little bit more flexible.
>
> Thanks in advance!

 
Reply With Quote
 
=?Utf-8?B?QmFnbG9n?=
Guest
Posts: n/a
 
      11th Sep 2007
I'm sorry, I don't understand the response. The data source name is
export.xls... could you please clarify? Thanks!

"barnabel" wrote:

> concatenate in the path from the activeworkbook. Something like :
>
> SELECT [everything$].ID, [everything$].UID, ...
> FROM `" & activeworkbook.path & "\`.[everything$] [everything$]
>
> Peter Richardson
>
> "Baglog" wrote:
>
> > Hi Everyone,
> >
> > I am creating an excel workbook that I would like to distribute to others.
> > This workbook uses another excel workbook as the data source. Currently, the
> > select statement looks like this:
> >
> > SELECT [everything$].ID, [everything$].UID, ...
> > FROM `C:\path\export`.[everything$] [everything$]
> >
> > What I would like to accomplish is remove the "C:\path" part and have the
> > query look for the data store in the same directory as the workbook. This
> > should allow me to zip up the file and the data store and distribute it to
> > others with the instructions to just overwrite the the data store with more
> > current information.
> >
> > I have changed the FROM line to read:
> > FROM `export`.[everything$] [everything$]
> >
> > and I get an error: Could not add the table '`export`.[everything$]'.
> >
> > Is there a graceful way to accomplish this? My backup plan is to just force
> > the users to use a hard-coded directory (small user community), but I'd like
> > to shoot for something a little bit more flexible.
> >
> > Thanks in advance!

 
Reply With Quote
 
=?Utf-8?B?YmFybmFiZWw=?=
Guest
Posts: n/a
 
      11th Sep 2007
Sorry I took out too much. Simply replace the "C:\PATH" part with the value
for Activeworkbook.path This will be the path to the workbook that they had
selected when they ran the macro so should give the folder they copied the 2
books into.

SELECT [everything$].ID, [everything$].UID, ...
FROM `" & activeworkbook.path & "\export`.[everything$] [everything$]


"Baglog" wrote:

> I'm sorry, I don't understand the response. The data source name is
> export.xls... could you please clarify? Thanks!
>
> "barnabel" wrote:
>
> > concatenate in the path from the activeworkbook. Something like :
> >
> > SELECT [everything$].ID, [everything$].UID, ...
> > FROM `" & activeworkbook.path & "\`.[everything$] [everything$]
> >
> > Peter Richardson
> >
> > "Baglog" wrote:
> >
> > > Hi Everyone,
> > >
> > > I am creating an excel workbook that I would like to distribute to others.
> > > This workbook uses another excel workbook as the data source. Currently, the
> > > select statement looks like this:
> > >
> > > SELECT [everything$].ID, [everything$].UID, ...
> > > FROM `C:\path\export`.[everything$] [everything$]
> > >
> > > What I would like to accomplish is remove the "C:\path" part and have the
> > > query look for the data store in the same directory as the workbook. This
> > > should allow me to zip up the file and the data store and distribute it to
> > > others with the instructions to just overwrite the the data store with more
> > > current information.
> > >
> > > I have changed the FROM line to read:
> > > FROM `export`.[everything$] [everything$]
> > >
> > > and I get an error: Could not add the table '`export`.[everything$]'.
> > >
> > > Is there a graceful way to accomplish this? My backup plan is to just force
> > > the users to use a hard-coded directory (small user community), but I'd like
> > > to shoot for something a little bit more flexible.
> > >
> > > Thanks in advance!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel query help with union select newbie Microsoft Excel Discussion 2 23rd Nov 2009 10:08 PM
Select Union query in Excel mikeb Microsoft Excel Programming 2 15th Dec 2008 07:46 PM
I was asked to change excel spreadsheet to make multiple select =?Utf-8?B?eWFrb3Y=?= Microsoft Excel Worksheet Functions 1 22nd Sep 2006 05:26 PM
Excel MS Query multiple select statements Revenger Microsoft Excel Misc 3 12th May 2006 12:32 PM
How do I select on a SQL Datetime field in Excel Query? =?Utf-8?B?U21vcmdhbg==?= Microsoft Excel Programming 1 15th Oct 2004 03:25 AM


Features
 

Advertising
 

Newsgroups
 


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