Search notes:

Access Object Model: CurrentProject

Application.CurrentProject contains interesting properties such as allForms, allMacros, allModules and allReports.

Methods and properties

accessConnection
addSharedImage()
allForms
allMacros
allModules
allReports
application
baseConnectionString
closeConnection()
connection Returns an ADO, not a DAO connection object
fileFormat
fullName
importExportSpecifications
isConnected
isTrusted
isWeb
name
openConnection()
parent
path
projectType
properties
removePersonalInformation
resources
updateDependencyInfo()
webSite

allForms

The property allForms returns an allObjects(!) object.

baseConnectionString

currentProject.baseConnectionString might return something like
PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=P:\projects\theDB.accdb;PERSIST SECURITY INFO=FALSE;Jet OLEDB:System database=C:\Users\Rene\AppData\Roaming\Microsoft\Access\System.mdw
This seems to be an OLE DB connection string.

connection

currentProject.connection returns an ADODB connection object.
option explicits

sub main()

    dim conn_ado as ADODB.connection
    dim conn_dao as DAO.connection

 '
 '  currentProject.connection returns an ADO
 '  connection object, not a DAO connection object.
 '  So, the following assignment works:
    set conn_ado = currentProject.connection

 '  while the following assignment would cause
 '  a "Type Mismatch" Error:
 '  set conn_dao = CurrentProject.Connection

end sub
Github repository about-MS-Office-object-model, path: /Access/CurrentProject/connection.bas
In order to get call execute on a DAO object, currentDB.execute should be used.

See also

Access Object Model

Index