469,362 Members | 2,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

Locations of .dll files

I seem to remember reading somewhere that, if you do not include the .dll
path name in the VBA 'Declare Function' statement, Windows looks in the
following places for .dlls (in this particular order):

1)The MS Access executable directory
2)The current directory (i.e. the same dir as the .mdb)
3)windows\system32
4)other places... (maybe looks at the "path=" enviroment variable?)

Firstly, is this right?

If so, why is Access failing to find the .dll even though it is in the same
dir as the .mdb (case 2 above)?

If I move the .dll to windows\system32, it finds it no problem. If I specify
a path (e.g.:

Declare Sub xyzdll Lib "c:\foo\xyz.dll"

it works no problem.

But if I just leave it sitting in the same dir as the .mdb:

"Run time error '53': File not found"

I'm (pretty) sure that this used to work.

Any suggestions?
TIA

PS: Running MSAccess XP

--
Scott

Xbox Live Gamertag: scottmorrison
Xbox Live Games: Top Spin, PGR2, RS3, RTCW, CounterStrike, Tetris
Nov 12 '05 #1
2 4455
The current directory isn't necessarily the same as the directory where the
..mdb is located. To prove this, open your database, go to the Debug window,
type ?CurDir then hit enter.

What you'll get depends on how you opened the database. If you opened it by
double clicking on it, you'll get whatever's set as the Default Database
Folder (specified on the General tab under Tools | Options). If you opened
it by navigating to it through the File Open dialog, then it'll be the same.
If you opened it using a shortcut, you can set the current directory in the
shortcut.

One possibility (untested) would be to use ChDir to set the current
directory when you open the database.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Scott" <no****@nospam.com> wrote in message
news:31dfc.16608$4N3.4580@newsfe1-win...
I seem to remember reading somewhere that, if you do not include the .dll
path name in the VBA 'Declare Function' statement, Windows looks in the
following places for .dlls (in this particular order):

1)The MS Access executable directory
2)The current directory (i.e. the same dir as the .mdb)
3)windows\system32
4)other places... (maybe looks at the "path=" enviroment variable?)

Firstly, is this right?

If so, why is Access failing to find the .dll even though it is in the same dir as the .mdb (case 2 above)?

If I move the .dll to windows\system32, it finds it no problem. If I specify a path (e.g.:

Declare Sub xyzdll Lib "c:\foo\xyz.dll"

it works no problem.

But if I just leave it sitting in the same dir as the .mdb:

"Run time error '53': File not found"

I'm (pretty) sure that this used to work.

Any suggestions?
TIA

PS: Running MSAccess XP

--
Scott

Xbox Live Gamertag: scottmorrison
Xbox Live Games: Top Spin, PGR2, RS3, RTCW, CounterStrike, Tetris

Nov 12 '05 #2
On Apr 14 2004, 11:46 am, "Scott" <no****@nospam.com> wrote in
news:31dfc.16608$4N3.4580@newsfe1-win:
I seem to remember reading somewhere that, if you do not include the .dll
path name in the VBA 'Declare Function' statement, Windows looks in the
following places for .dlls (in this particular order):

1)The MS Access executable directory
2)The current directory (i.e. the same dir as the .mdb)
3)windows\system32
4)other places... (maybe looks at the "path=" enviroment variable?)

Firstly, is this right?


Not quite. It doesn't look in the mdb's directory (which as Doug said is
not the same as the current directory). It looks in the application
directory. From Windows' point of view, this is where msaccess.exe is
located.

--
remove a 9 to reply by email
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Johnny van Cadsand | last post: by
9 posts views Thread by Nimmi Srivastav | last post: by
2 posts views Thread by Dan Baker | last post: by
1 post views Thread by JohnSouth | last post: by
reply views Thread by esha | last post: by
4 posts views Thread by John Dann | last post: by
reply views Thread by eholz1 | last post: by
4 posts views Thread by oldeast | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.