Custom Add-in calling another custom Add-in


Question

How do I call the addin form so it opens up in the current mdb just like regular addins do? For example: I'm working in XYZ.mdb and am using a form, frm123 from an addin called 123.mda. And I want to open a form called frmBingo from an addin called Bingo.mda. How?

Answer


George,

This seems to be undocumented, but AFAIKR several days ago Michael Kaplan wrote about this trick in one of the microsoft.public.access.* newsgroups, namely he showed how Run is used to call autodialer in utility.mda:

Application.Run "utility.wlib_AutoDial", ""

The same trick can be used to solve (?) the subject:

  • in xyz.mdb write code:
    Public Sub frm123Open()
      Application.Run "123.frm123Open"
    End Sub
    
  • in 123.mda create form frm123 and write code:
    Public Sub frm123Open()
      DoCmd.OpenForm "frm123"
    End Sub
    
  • Create button [cmdOpenBingo] on frm123 and write the code to process its Click event:
    Private Sub cmdOpenBingo_Click()
      Application.Run "Bingo.frmBingGoOpen"
    End Sub
    
  • in Bingo.mda create form frmBingo and write code:
    Public Sub frmBingGoOpen()
      DoCmd.OpenForm "frmBingo"
    End Sub
    
  • Copy 123.mda and Bingo.mda to the directory defined by the following Registry Value:
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\8.0\Access\Wizards]
    "AddInPath"="<Your path here>"
    

Be careful with CurrentDB() refs in your .MDAs - probably you will have to change them to CodeDB()...

This is an interesting technique with a lot of other possible tricks which can be coded based on it but probably it's too tricky to be used in real apps/add-ins...

What can you say about that, Michael?

HTH,
Shamil


Copyright © 1999-2008 by Shamil Salakhetdinov. Original version is published here All rights reserved.