View Single Post
  #3 (permalink)  
Old February 20th, 2005, 02:22 PM
Bob Bedell Bob Bedell is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Hi Eric,

I've been playing around with Terry Kreft's open source Reference Wizard for a bit since you posted, and notice that the article Randall posted contains a link to it too. I think it might work for you.

The link for the reference wizard is at http://www.mvps.org/access/modules/mdl0022.htm.

I've been able to use it to repair a broken reference to the DAO library in a 2K2 database. Here's how I went about it.

1. The Reference Wizard is a MDA library in A97 format. So I first converted it to A2K2 format, then created an MDB in A2K2 format to host the MDA.

2. The first thing you want to do is convert the MDA to an MDE. Otherwise you won't be able to convert the host MDB to an MDE after setting a reference to the converted MDA.

Before you convert the Wizard to an MDE, however, add a new standard module to it named "basOpenForm". Add this code to the standard module:

Sub OpenForm(frmName As String)
    DoCmd.OpenForm frmName, , , , , acDialog
End Sub

This will allow you to open forms in the MDA by calling them from MDB code. The form in the Wizard you are interested in is named "wzfrm_USysRefInfo". This form uses a callback function to populate a list box with the references set in the host MDB application. If any references .IsBroken property returns True, the broken reference will be listed and flagged in the list box. "wzfrm_USysRefInfo" includes two command buttons that enable you to Repair the broken references and Refresh the references by reading/creating registry keys. Once you have basOpenForm added to the MDA, recompile it to be sure you don't have compilation errors that would prevent an MDE from being created, then create the MDE version of the Wizard.

3. After you get the Reference Wizard converted to an MDE, open your host MDB's VBA editor and set a reference to the MDE version of the Reference Wizard (just as you would set a reference to any other class library). Create a new form in the host MDB that will enable you to invoke "wzfrm_USysRefInfo" from a command button. Add the following code in the command buttons OnClick event:

Private Sub Command0_Click()
    Call OpenForm("wzfrm_USysRefInfo")
End Sub

This routine calls into the referenced MDE version of the Wizard and loads "wzfrm_USysRefInfo" in the host MDB.

4. Once the MDB is working OK with the MDE version of the Wizard, create a MDE version of the host MDB application.

At this point you should be good to go. Of course, the only method I had available to test reparing the broken DAO reference was to physically move the dao360.dll from the C:\Program Files\Common Files\Microsoft Shared\DAO folder, open the app, check to see that the broken reference was listed (it was), place the DAO dll back in its shared folder, and click the Repair button on wzfrm_USysRefInfo (the reference to DAO was repaired correctly).

So there you have it if you feel like playing around with an MDA for a bit and distributing it with your MDE app.

HTH,

Bob

Reply With Quote