Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Where to put the sub-programm, GetOpenFile

Thanks Dick for you're help. My only problem is, and maybe this is a very
simple and stupid question. Where do I put the sub-programm Get open File in
my SQL texture (existing query). (SELECT `Blad1$`.`Cost ctr`,
Sum(`Blad1$`.`Val#in rep#cur#`) AS 'Totale kosten per Costctr'
FROM `Y:\MIJN DOCUMENTEN\Excel bestand te exporteren`.`Blad1$` `Blad1$`
WHERE (`Blad1$`.`D/C`='D') OR (`Blad1$`.`D/C`='C')
GROUP BY `Blad1$`.`Cost ctr`)

.. Because if I put it in, MSquery tells me that he can't display the table
and he can't find the table.



"Dick Kusleika" wrote:

Mark

You can write a macro to do this. See here for how to change the database
location programmatically

http://www.dicks-clicks.com/excel/Ex...htm#ChangeConn

and see here for using GetOpenFilename to have the user select a database

http://www.dicks-blog.com/excel/2004...nfilename.html

Post back if you need more specifics.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com


Mark van der Sluis wrote:
Thanks for the answer

You are right about the SQL, I found it out myself. Only the problem is,
how can I explain this to a noob in excel, because I'm building these
query's for my boss, he has to use them a lot, but isn't able to
understand this. So actually I want him to choose a file to work with,
everytime he uses the query's. Maybe it's possible to programm something
that if he uses the query's he has to select an external database, that
would be the best. Is this possible???


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Where to put the sub-programm, GetOpenFile

fName = GetOpenFileName()
sSQL = _
"SELECT `Blad1$`.`Cost ctr`, " & _
"Sum(`Blad1$`.`Val#in rep#cur#`) AS 'Totale kosten per Costctr'" & _
"FROM `" & fName & "`.`Blad1$` `Blad1$`" & _
"WHERE (`Blad1$`.`D/C`='D') OR (`Blad1$`.`D/C`='C')" & _
"GROUP BY `Blad1$`.`Cost ctr`"

Would build the query string. Not sure how you want to use it.

--
Regards,
Tom Ogilvy

"Mark van der Sluis" wrote in
message ...
Thanks Dick for you're help. My only problem is, and maybe this is a very
simple and stupid question. Where do I put the sub-programm Get open File

in
my SQL texture (existing query). (SELECT `Blad1$`.`Cost ctr`,
Sum(`Blad1$`.`Val#in rep#cur#`) AS 'Totale kosten per Costctr'
FROM `Y:\MIJN DOCUMENTEN\Excel bestand te exporteren`.`Blad1$` `Blad1$`
WHERE (`Blad1$`.`D/C`='D') OR (`Blad1$`.`D/C`='C')
GROUP BY `Blad1$`.`Cost ctr`)

. Because if I put it in, MSquery tells me that he can't display the table
and he can't find the table.



"Dick Kusleika" wrote:

Mark

You can write a macro to do this. See here for how to change the

database
location programmatically

http://www.dicks-clicks.com/excel/Ex...htm#ChangeConn

and see here for using GetOpenFilename to have the user select a

database

http://www.dicks-blog.com/excel/2004...nfilename.html

Post back if you need more specifics.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com


Mark van der Sluis wrote:
Thanks for the answer

You are right about the SQL, I found it out myself. Only the problem

is,
how can I explain this to a noob in excel, because I'm building these
query's for my boss, he has to use them a lot, but isn't able to
understand this. So actually I want him to choose a file to work with,
everytime he uses the query's. Maybe it's possible to programm

something
that if he uses the query's he has to select an external database,

that
would be the best. Is this possible???




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 could VBA connect with another customized application programm Ella Excel Discussion (Misc queries) 1 October 20th 07 11:40 PM
how to set excel pagebreak in programm chengquan Excel Programming 0 August 12th 03 10:02 AM


All times are GMT +1. The time now is 03:07 AM.

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"