Referenced database for not found

Jaye7

Registered User.
Local time
Tomorrow, 02:30
Joined
Aug 19, 2014
Messages
205
I referenced another database in the references and then when I first opened a form from the referenced database it opened, but once I closed the database and reopened I keep getting an error 2102 the form name is misspelled or doesn't exist, yet it clearly exists.

I have removed the reference, closed and reopened and tried to add the reference again with no joy.

Which is weird as if I view object from the vba editor the form opens in design mode.

The code to open the form is.

Code:
Public Sub OpenReferencedUI()
   DoCmd.OpenForm "Organizations"
End Sub
 
Last edited:
does the public sub, OpenReferencedUI in your referenced db?
does qualifying that public sub, have same result?

Call yourReferencedDB.moduleOfRefSub.OpenReferencedUI
 
Thanks for you help.
I didn't realize that the following should be in the referenced database.

Code:
Public Sub OpenReferencedUI()
 DoCmd.OpenForm "Organizations" 
End Sub
And then in the current database just call the script and everything works from there.

Code:
OpenReferencedUI
 
You can improve it
In your referenced db put this
Code:
Public sub openRefForm(strForm as string)
Docmd.OpenForm strForm
End sub
In your db call it
Code:
openRefForm FormToOpen

You can improve it more by adding all the optional vars to the form open arguments
 
Thanks Smig,

That is a great improvement and will be very handy.
 

Users who are viewing this thread

Back
Top Bottom