Solved How to get the project name? (1 Viewer)

Local time
Today, 14:46
Joined
Aug 10, 2024
Messages
39
How do I get the project name (here FooDB) as seen in the picture?

Code:
CurrentProject.Name
gives me the file name (here Database1.accdb).

Thank you.
 

Attachments

  • Database Name.png
    Database Name.png
    20.7 KB · Views: 32
use:

CurrentProject.Name
 
How do I get the project name (here FooDB) as seen in the picture?

Code:
CurrentProject.Name
gives me the file name (here Database1.accdb).

Thank you.
To get the VBA Project Name, you have to use:
Code:
Application.VBE.VBProjects(1).Name

1729399479460.png
 
Ah, OK.
I get the same?
1729510835805.png


In fact, mine always appear to be the same?
1729510976828.png
 
I know, I just renamed it as a test, but what benefit do you get by having them different? :unsure:
 
what benefit do you get by having them different?
The (VBA)project name is independent of the file name, which is a huge benefit when your file name is something like "Diabetes_Backup_20241010_RestoredToRecoverLostForms_20241014.accdb"
 
I know, I just renamed it as a test, but what benefit do you get by having them different? :unsure:
I noticed this when I was inspecting the source property of the ErrorObject. VBA sets it to the project name and not the file name. Of course you will never notice this unless you set the project name explicitly to something else than the default.
 

Users who are viewing this thread

Back
Top Bottom