(Msg. 1) Posted: Fri May 16, 2008 6:52 pm
Post subject: Query macro to use default directory Add to elertz Archived from groups: microsoft>public>excel>querydao (more info?)
Hi All.....
I have a little Query macro that works just fine on my computer, but
unfortunately has the path to the source file hard coded inside. I would
like the Query to always look to the default directory that the Excel
program is in to find the source file to query......no joy in any of my
efforts.......anybody know how?
Heres the code.........
Sub GetAccessFile()
Sheets("MainMenu").Select
Sheets.Add
ActiveSheet.Name = "NPRdatabase"
(Msg. 2) Posted: Sat May 17, 2008 11:30 am
Post subject: Re: Query macro to use default directory Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
The macro recorder and MSQuery combine to make a pigs ear of the creation of
querytables. At one time there was a limit of 200 characters or so in the
Connection and Command parameters and they had to be turned into arrays of
strings; this is no longer the case (if I recall correctly).
The SQL is unnecessarily verbose and does not need to include the filename or
(in this case) the table name before each field name since there is only one
table involved.
I think the following should work
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum