By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 2,763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

Locations of .dll files

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.