2007 , , , LoadFromFile SaveToFile.
, ( DAO)... , .
' Instantiate the parent recordset.
Set rsEmployees = db.OpenRecordset("YourTableName")
''' Code would go here to move to the desired record
' Activate edit mode.
rsEmployees.Edit
' Instantiate the child recordset.
Set rsPictures = rsEmployees.Fields("Pictures").Value
Debug.Print rsPictures.RecordCount'' <- SEE IF THIS GIVES YOU THE COUNT
EDIT: ; .
, . Access 2010, .
1. , . .
Function AttachmentCount(TableName As String, Field As String, WhereClause As String)
Dim rsRecords As DAO.Recordset, rsAttach As DAO.Recordset
AttachmentCount = 0
Set rsRecords = CurrentDb.OpenRecordset("SELECT * FROM [" & TableName & "] WHERE " & WhereClause, dbOpenDynaset)
If rsRecords.EOF Then Exit Function
Set rsAttach = rsRecords.Fields(Field).Value
If rsAttach.EOF Then Exit Function
rsAttach.MoveLast
rsAttach.MoveFirst
AttachmentCount = rsAttach.RecordCount
End Function
2. Access.
SELECT Table1.ID, AttachmentCount("Table1","MyAttach","[ID]=" & [ID]) AS [Num Attach]
FROM Table1;
1 - , , 2 - , , - WHERE , .
, !
UPDATE
SQL- :
SELECT t.ID, Count(t.MyAttach.FileName) AS [Num Attachments]
FROM Table1 AS t
GROUP BY t.ID;