Open Form from Anothe Database

bbProg

New member
Local time
Today, 04:31
Joined
Sep 3, 2015
Messages
4
Hi All,

I have a customer with a few access 2010 databases which I converted a while ago from access 97.
when I noticed that there is code that's being used by more than one database, I created a common database with only modules where I placed the code that's being used by other databases and created a reference in the vba editor (tolls > references) to this common database.

I have also noticed that there are some forms that are being used by more than one database, like "Send Email" or "Help" form...

is it possible to open a form that is located in the common database as if it's being used locally as with functions "call CommonDB.SubName()"?

I tried docmd.OpenForm CommonDB.FormName or docmd.OpenForm CommonDB.Forms("FormName") but this didn't work...

thanks,
 
Since that db is referenced then there should be no need to repeat its name in the calls at all.
 
still, it's not working. i'm getting the error message "method or data member not found" on the .Forms
 
When asking for help show what you've done EXACTLY
 
sorry, I thought that my explanation was clear enough...

I have a few databases (db1, db2, db3...) which use the same functions and subroutines (RelinkTables, some string operations...), so I created another database (CommonDB) where I placed in modules the functions and subroutines which are being used by all other databases and at the vba editor created a reference to the common database. then I changed the code to refer to the functions and subroutines from the common database (where I had call RelinkTables I changed to call CommonDB.RelinkTables)

because some of the forms are being used by db1, d2 and db3, I would like to do the same with forms. while working on db1, to open form that exists in CommonDB, without creating another instans of access and open Form1 there, just open Form1 which is located in CommonDB as if it is part of db1, at the same or similar way as with the common functions and subroutines. something like "docmd.OpenForm CommonDB.Form1" or "docmd.OpenForm CommonDB.Forms("Form1")"...

hope this clear things out... :)
 
I managed it :)

had to create on CommonDB another subroutine called "OpenCommonForm(fName as string, myOpenArgs as string)" with the code docmd.OpenForm FormName and on each other database (db1, db2, db3...) calledthe subroutine "Call CommonDB.OpenCommonForm("Form Name","Open Arguments")".
 

Users who are viewing this thread

Back
Top Bottom