Access Connectivity Engine

Previously called DAO (Data Access Objects)
Added in Access 2007.


References

Microsoft Office 12.0 Access Database Engine Object
DAO 3.6 Object Library
DAO 3.51 Object Library


History

Access 2007+ - ACE is the default
Access 2003 - DAO was the default
Access 2002 - ADO was the default
Access 2000 - ADO was the default
Access 1997 - DAO was the default


DbDAOworkspace.begintrans
DbDAOWorkspace.committrans - Commiting a transaction
[Column] is Null - Searching for a null value


This includes all tables including hidden and system

Debug.Print currentdb.TableDefs.Count 

This returns all the open forms

Debug.Print forms.Count 

Public dbDAOWorkspace as DBEngine.Workspace 
Public dbDAODatabase as DBEngine.Database
Public dbDAORecordset as DBEngine.recordset
Dim sSQLQuery as string

Set dbDAOWorkspace = DBEngine.CreateWorkspace(



Set dbDAODatabase = dbDAOWorkspace.OpenDatabase(



SSQLQuery = ""

Set dbDAORecordset = dbDAODatabase.OpenRecordset(


(???? Set dbDAORecordset = dbDAODatabase.Execute sSQLQuery ????)


Function exampleDAOQuery() As Long 

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strQry As String

On Error GoTo exampleDAOQuery_Error

Set dbs = CurrentDb()
strQry = "SELECT Count(Column1) As numRecords from tblExample" 'SQL
Set rst = dbs.OpenRecordset(strQry)
With rst
exampleDAOQuery = !numRecords 'return number of records to function
.Close 'close the DAO recordset
End With
dbs.Close 'close the DAO database connection
Set rst = Nothing 'free up system resources
Set dbs = Nothing 'free up system resources

On Error GoTo 0
Exit Function

exampleDAOQuery_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ")", vbCritical

End Function


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext