How to reference an attached mdb?

P

phpons

Hi,

In my main Access application, I referenced another mdb file of
which I need to run aform from the main.

Thank's to Marshall Barton, the foloowing code is ok.

Public Function ppSendEmail()
' init de la gestion d'erreur: la bibliothèque peut ne pas avoir
été référencée
On Error GoTo ppSendEmail_Error

AccXP_Mail.modDivers.openFrmCourriel
' AccXP_Mail: the name of the project of the AccXP_Mail.mdb
attached
' modDivers: the name of the code module
' openFrmCourriel: the public function that opne the form
On Error GoTo 0
Exit Function

ppSendEmail_Error:

MsgBox ("La fonction d'envoi d'email n'est pas installée!")
End Function

The problem is that in case the AccXP_Mail.mdb is not attached, a
compilation error is triggered due to the fact that
AccXP_Mail has not been declared. And the error is not trapped by the
On Error GoTo ppSendEmail_Error.
I tried different things to try declare AccXP_Mail, but unsuccessfully
till now.
Like Dim AccXP_Mail As Access.Application
How would you do that?

Thank's in advance,

Philippe
 
Top