Field is a reserved word and should not be used as a variable/object/table/field name.
The function you have copied from another forum does not do what you want so presumably had another purpose
try this alternative - note this is returns an integer because there are 3 possible responses based on your example code. If you want a boolean you need to take out the 'If Rst.RecordCount = 1' clause
Code:
Public Function CheckIfAllNulls(ByVal Id As Long) As integer
Dim Rst As DAO.Recordset
Dim Fld As DAO.Field
Dim AllNull As integer
Set Rst = CurrentDb.OpenRecordset("Select * From tbltest Where Id = " & Id, dbfailonerror)
AllNull=1
If Rst.RecordCount = 1 Then 'only one record to test which is the requirement
For Each Fld In Rst.Fields
If Fld.Name <> "Id" Then
If nz(Fld.Value,"") <> "" Then 'this field as a value
AllNull=0
Exit For
end if
Next fld
allnull=-allnull ' i.e. if allnull=1 then allnull=-1
End If
Rst.Close
CheckIfAllNulls = AllNull '-1 means all null, 0 means not all null, 1 means more than one record so not tested
End Function
and in your sql
SELECT ID
FROM tblTest
WHERE CheckIfAllNulls([ID])=-1