DAOを使用して、開いているExcelシート(http://support.microsoft.com/kb/319998)でメモリリークを回避します。次に例を示します。
'Reference: Microsoft Office x.x Access Database Engine Object Library
Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim sDb As String
Dim sSQL As String
Dim qdf As QueryDef
sDb = "Z:\Docs\Test.accdb"
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(sDb)
''A stored query would be better
sSQL = "Parameters p1 Text, p2 Datetime; " _
& "INSERT INTO Table1 (AText,ADate) Values ([p1],[p2])"
Set qdf = db.CreateQueryDef("", sSQL)
qdf.Parameters!p1 = "ABC"
qdf.Parameters!p2 = #2013/1/17#
qdf.Execute dbFailOnError
Debug.Print qdf.RecordsAffected