السلام عليكم
 
	انا عندى اوفيس 2016
 
	عندى استعلام نطاق بين تاريخين وعندما لا يوجد بيانات  يظهر #error
 
	جربت الكود دا
 
Public Function FormHasData(frm As Form) As Boolean
    'Purpose:   Return True if the form has any records (other than new one).
    '           Return False for unbound forms, and forms with no records.
    'Note:      Avoids the bug in Access 2007 where text boxes cannot use:
    '               [Forms].[Form1].[Recordset].[RecordCount]
    On Error Resume Next    'To handle unbound forms.
    FormHasData = (frm.Recordset.RecordCount <> 0&)
End Function
	وبعدين المعادلة
 
	=IIf(FormHasData([Form]), Sum([Amount]), 0)
 
	المشكلة مازالت قائمة
 
	ارجو الافادة