Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Excel
123quattro
charting
crashesgpfs
datamap
excel
interopoledde
links
misc
newusers
printing
programming
querydao
sdk
setup
templates
worksheet.functions
  
 
date: Tue, 22 Apr 2008 06:46:43 -0500,    group: microsoft.public.excel.querydao        back       


Requery issue when moving master file to other PC   
I am having an issue with a requery from my master file when I try to use it 
on other PCs at my workplace.

I went into the Edit Query mode and attempted to change the path for my data 
file, but I am getting the following message [Microsoft][ODBC Excel Driver] 
and then the file path is an invalid path.

Has anyone experienced an issue like this before?

Can anyone offer a suggestion?

Mark Ivey
date: Tue, 22 Apr 2008 06:46:43 -0500   author:   Mark Ivey

Re: Requery issue when moving master file to other PC   
Sorry no-one got back to you sooner.

MSQuery has an annoying habit of including the path to the datasource 
in the SQL of the query.  Like
SELECT MyField FROM `C:\MyDir\MySubDir\MyFile.mdb`.MyTable MyTable
when
SELECT MyField FROM MyTable
would suffice, since the Connection parameter defines the location of 
the datasource.

So you have to persuade it to change the SQL as well as the Connection 
parameter of the QueryTable.

There are a number of ways you could go about programatically changing 
the SQL and Connection properties to address the file correctly.
My preference is to create the query, put the cursor in the result area 
and in the VB editor immediate window do
?ActiveCell.QueryTable.SQL
and
?ActiveCell.QueryTable.Connection

Then I write code that sets the SQL and Connection correctly to where 
the source file will be found (often relative to ThisWorkbook.Path)

Bill Manville
MVP - Microsoft Excel, Oxford, England
date: Sat, 26 Apr 2008 22:59:19 GMT   author:   Bill Manville

Re: Requery issue when moving master file to other PC   
Many thanks for the response and information...

It may be a day or two before I can test this information, but I will let 
you know the results either way...

Mark Ivey



"Bill Manville"  wrote in message 
news:VA.00001497.13081b27@msn.com...
> Sorry no-one got back to you sooner.
>
> MSQuery has an annoying habit of including the path to the datasource
> in the SQL of the query.  Like
> SELECT MyField FROM `C:\MyDir\MySubDir\MyFile.mdb`.MyTable MyTable
> when
> SELECT MyField FROM MyTable
> would suffice, since the Connection parameter defines the location of
> the datasource.
>
> So you have to persuade it to change the SQL as well as the Connection
> parameter of the QueryTable.
>
> There are a number of ways you could go about programatically changing
> the SQL and Connection properties to address the file correctly.
> My preference is to create the query, put the cursor in the result area
> and in the VB editor immediate window do
> ?ActiveCell.QueryTable.SQL
> and
> ?ActiveCell.QueryTable.Connection
>
> Then I write code that sets the SQL and Connection correctly to where
> the source file will be found (often relative to ThisWorkbook.Path)
>
> Bill Manville
> MVP - Microsoft Excel, Oxford, England
>
date: Sat, 26 Apr 2008 19:16:16 -0500   author:   Mark Ivey _(do_not_spam)

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us