Fault referencing libs in MDE files (Custom profiles)


Question

I'm needing some clues about the libraries in ACC97, perhaps someone can tell me what I'm doing wrong...

Answer

Buho,

I use references with both source and compiled mdbs and custom profiles but I don't think I can explain the "references usage/resolution magic rules" in all the details, but I try:

Here is a piece from MS Access 97 online help I used to solve this problem more than one year ago:

"If you set a reference to a project or type library from Microsoft Access and then move the file that contains that project or type library to a different folder, Microsoft Access will attempt to locate the file and reestablish the reference. If the RefLibPaths key exists in the registry, Microsoft Access will first search there. If there's no matching entry, Microsoft Access will search for the file first in the current folder, then in all the folders on the drive. You can create the RefLibPaths key by using the Registry Editor in Windows, under the registry key \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\8.0\Access. For more information about using the Registry Editor, see your Windows documentation."

It is correct and MS Access 97 resolves references as described in it except that it seems that it does not search in "all the folders on the drive" - it searches only in the folders which are defined in the PATH environment variable.

Yes, it is correct and it works but before you get it to work you need to re-read it hundred times and experiment five hundreds... at least I did so to get it working... Very important to keep in mind what is the *current folder* when you start you app .mdb, i.e. when you start it using "file->open" - then the current folder is its own folder, when you start your app using short-cut - then the current folder could be any, when you start it from picklist then again the current folder could be any etc...

ReflibPaths key:

- for default MS Access profile you define it this way:

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\8.0\Access\RefLibPaths]
"smslib.mdb"="C:\\daisy\\libraries\\"

(you can copy these exported registry lines into text file and import into registry using regedit - then
enter/edit ReflibPaths' key values to set references to your libraries)

- for custom profile you define it, e.g., this way:

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\DARTS Ltd.\Distributed Accounting System\0.00\DASProfile\RefLibPaths]
"ADocLib.mdb"="C:\\daisy\\Libraries\\"
"applib.mdb"="C:\\daisy\\Libraries\\"
"daslib.mdb"="C:\\daisy\\Libraries\\"
"smslib.mdb"="C:\\daisy\\Libraries\\"

plus

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\8.0\Access\Profiles]
"DASProfile"="SOFTWARE\\DARTS Ltd.\\Distributed Accounting System\\0.00\\DASProfile"

When you experiment with references auto-resolution on your development PC *always* rename your development directory, i.e. if your development directory is c:\abc and you copy all your app files to, say, c:\xyz and set Reflibpaths for deault/custom profiles pointing to c:\xyz\... then rename c:\abc to c:\abc_main before you start your app from c:\xyz\...

If you have both source and compiled libraries on one PC use different profiles for them...

There are some other rules you have to follow to have no problems with references but the two main keypoints/hints are:

- current directory
- auto-resolution and profile reflibpaths work (are activated) for broken-refs only...

All the errors from your original message seems to be "born" because of the violation of these two keypoints when you define refs/profiles, compile/move/run mdbs/mdes. And the error:

> If APP.MDE have a form who is loaded automatically I get a page fault in VBA332.DLL.

arise usually when compiled front-end .mdb (auto-)resolves/has reference(s) to uncompiled library mdb.

HTH,
Shamil


Copyright 1999-2008 by Shamil Salakhetdinov. All rights reserved.