Using RefLibPaths to resolve broken references - step by step example (AccessXP)


Question

Well, I put RefLibPaths on my machine, but when I open the application from a full version of Access, I still get a broken reference. Is there something else I have to do to kick Access in the pants and make it actually use RefLibPaths to resolve the reference?

Answer

  1. start MS Access XP and create a code library test database e:\consult\Charlotte\MyLib.mdb
  2. create standard module [MyModule] with the following code
  3. Public Function MyFunction()
           MsgBox "MyMessage",  vbInformation + vbOKOnly, "Test RefLibPaths"
    End Function
    
  4. make mde file: Tools->Database Utilities->Make MDE File: 
    MyLib.Mdb -> MyLib.mde
  5. create a database e:\consult\Charlotte\MyApp.mdb
  6. open VB (Alt+F11) window
  7. from VB window menu Tools->References... open [References] dialog window
  8. click [Browse] to open [Add Reference] dialog window
  9. type e:\consult\Charlotte\MyLib.mde in the [File name] textbox
  10. click the button [Open] - reference e:\consult\Charlotte\MyLib.mde will be added
  11. click the button [OK] to close references window
  12. switch to Microsoft Access window (Alt+F11)
  13. create a form frmTest with a button cmdTest
  14. create OnClick event's code for the [cmdTest] button
  15. Private Sub cmdTest_Click()
         myFunction
    End Sub
    
  16. save and close [frmTest] form
  17. open frmTest form in Normal view, click [cmdTest] button to see that [MyLib.mde].MyModule.MyFunction is called correctly and that test message appears
  18. close e:\consult\Charlotte\MyApp.mdb and quit MS Access
  19. rename e:\consult\Charlotte to e:\consult\CharlotteFoust
  20. make sure that all your files are in e:\consult\CharlotteFoust folder now
  21. create folder c:\testrefs
  22. copy MyApp.mdb into c:\testrefs
  23. open c:\testrefs\MyApp.mdb, open [frmTest] and click [cmdTestButton] - it will produce a message "Your Microsoft Access database of project contains a missing or broken reference to the file 'MyLib.mde'
  24. quit MS Access
  25. create a RefLibPath registry key under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0\Access\ and a value for this key
  26. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0\Access\RefLibPaths]
    "MyLib.mde"="e:\\consult\\CharlotteFoust\\"
    
  27. open c:\testrefs\MyApp.mdb, open [frmTest] and click [cmdTestButton] - it works now...

Download test files - testrefs.zip (90 600 bytes)


HOME    TOPICS

Copyright © 1998–2003 by Shamil Salakhetdinov.
All rights reserved. Terms of use.

Last updated: July 19, 2003