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
- start MS Access XP and create a code library test database e:\consult\Charlotte\MyLib.mdb
- create standard module [MyModule] with the following code
Public Function MyFunction()
MsgBox "MyMessage", vbInformation + vbOKOnly, "Test RefLibPaths"
End Function
- make mde file: Tools->Database Utilities->Make MDE File:
MyLib.Mdb -> MyLib.mde
- create a database e:\consult\Charlotte\MyApp.mdb
- open VB (Alt+F11) window
- from VB window menu Tools->References... open [References] dialog window
- click [Browse] to open [Add Reference] dialog window
- type e:\consult\Charlotte\MyLib.mde in the [File name] textbox
- click the button [Open] - reference e:\consult\Charlotte\MyLib.mde will be added
- click the button [OK] to close references window
- switch to Microsoft Access window (Alt+F11)
- create a form frmTest with a button cmdTest
- create OnClick event's code for the [cmdTest] button
Private Sub cmdTest_Click()
myFunction
End Sub
- save and close [frmTest] form
- open frmTest form in Normal view, click [cmdTest] button to see that [MyLib.mde].MyModule.MyFunction is called correctly and that test message
appears
- close e:\consult\Charlotte\MyApp.mdb and quit MS Access
- rename e:\consult\Charlotte to e:\consult\CharlotteFoust
- make sure that all your files are in e:\consult\CharlotteFoust folder now
- create folder c:\testrefs
- copy MyApp.mdb into c:\testrefs
- 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'
- quit MS Access
- create a RefLibPath registry key under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0\Access\ and a value for this
key
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0\Access\RefLibPaths]
"MyLib.mde"="e:\\consult\\CharlotteFoust\\"
- open c:\testrefs\MyApp.mdb, open [frmTest] and click [cmdTestButton] - it works now...
Download test files - testrefs.zip
(90 600 bytes)
|
HOME
TOPICS |
Copyright © 19982003 by Shamil Salakhetdinov.
All rights reserved. Terms of use. |
| Last updated: July 19,
2003 |
|
|
|