VBA CodeDB

Access CodeDB Method Example

CodeDb Method – You can use the CodeDb method in a code module to determine the name of the Database object that refers to the database in which code is currently running.
Use the CodeDb method to access Data Access Objects (DAO) that are part of a library database.

CodeDb Example:

Public Sub DisplayDB()
MsgBox CodeDb.Name
End Sub

The result will be a popup message with the full path and filename of the database running the code.

Below is an example of the popup message from the code above:

More CodeDB information from Microsoft:

 

Microsoft Office VBA, MS Access 2003, 2007, 2010, 2013, 2016

Scroll to top