I kind of solved the problem by just checking the prefix of the form name. That will tell me whether the form resides in the CurrentProject or CodeProject. For example, all of my forms in my library db begin with "frmHMS_". But I would prefer a more secure way of checking because some other programmer, at some point in time, may add a form whose name does not follow the convention.
I'll try to explain what I'm doing and why I'm doing it.
I have about a dozen databases I've created and about 200 users. So, to ensure that I don't inadvertantly modify the wrong data, I have 2 icons on the ribbon that indicate in which envrionment the form I'm currently accessing resides (i.e. Live, Test, Dev) and in which environment the table (RecordSource of the form) resides.
For the FE db, I have a table that specifies the folder the Live FE db resides and the folder the Test FE db resides, etc. Consequently, when the form opens I can compare CurrentProject.path with the values in the table to determine in which environment the form (ie the FE database) resides.
In the FE db I simply link all of my tables to the BE db that represents the Live environment and then run some code that stores the connection string of each table along with the name of the FE database. I then link all of my tables to the BE db that represent the Test environment and run the code that stores the connection string of each table. I do the same for Dev and Archive. So when I open a form I can check to see in which environment the Recordsource of the form is referencing by comparing connection strings. (This also gives me the ability to switch environments on the fly. For example, switching to the Archive BE database.)
My problem is that the form that I open could reside in my Library database (which may represent Live, Dev, Test) or the Current database. If the form is in the current database, I can check CurrentProject.path to determine the environment the FE db resides. Else I would check CodeProject.path. My original question was, is there a property or something that indicates the name and path of the database the form in question resides? For example, does Form1 reside in MyCurrentDb.accdb or does it reside in MyLibraryDb.accdb?
A thought: I could search MSysObject in both databases for the form in question. Assuming that I don't have same form name in both databases. I have no control over this since multiple programmers are developing databases using my library.