Saturday, 15 February 2014

vba - How to check the definitions of Classes in DBEngine.Workspaces(0) -


We have an inhouse system that has been developed with MS Access 2007. There is a logon form which uses the external tables using the default workspace ( DBegin. Workspace (0) ).

We have come to know which class and members are used but can not know which database is defined under DBEngine.Workspaces (0) Because the definition button is gray-out.

DBiGuin. Workspace (0) a DAO.Workspace object

DBEngine.Workspaces (0). Database is the collection of open databases within that scope. debug.print dbijin. Workspace (0) .Databases.Count will tell you how many databases are open in that workspace

The first code in those databases is . And you can inspect its .name property to get the full path to that database file:

  debug . Print DBNGen Workspace (0). Database (0) .name  

In a comment, you have also mentioned UserName . This is a property of the workspace, the database is not. You can check that property:

  debug Print DBN Gen Workspace (0) .USINEM  

However, unless you are using access user-level security, DBiGuin Workspace (0) .Username will be the default user, "Admin" . Therefore, in that case, usernames is not very useful


No comments:

Post a Comment