简体   繁体   中英

What's wrong with this Access query

What's wrong with this Access query. I get no errors, but no records:

There are many records that (seem to) match the criteria.

SELECT Members.[Last Name], Members.[First Name], Members.Address, Members.City, Members.State, Members.Zip, Members.[E-Mail] 
FROM Members 
WHERE (((Members.Inactive)=Yes) AND ((Members.Deceased)<>Yes) AND (IsEmpty(Members.[E-Mail])=Yes)) 
ORDER BY Members.[Last Name], Members.[First Name];

IsEmpty(Members.[E-Mail]) will return False for every row.

If you want a condition to select rows where E-Mail is Null, use IsNull([E-Mail]) or [E-Mail] Is Null

If you want a condition to select rows where E-Mail is a zero-length string, use Len([E-Mail]) = 0

If you want a condition to select rows where E-Mail is either Null or a zero-length string, use Len([E-Mail] & '') = 0

Do you want to match Members.Inactive , Members.Deceased etc. to the variable Yes or the string "Yes" ? If the latter, then you need to replace:

WHERE 
     (((Members.Inactive)=Yes) 
AND
     ((Members.Deceased)<>Yes) 
AND 
     (IsEmpty(Members.[E-Mail])=Yes)) 

With:

WHERE 
     (((Members.Inactive)="Yes") 
AND
     ((Members.Deceased)<>"Yes") 
AND 
     (IsEmpty(Members.[E-Mail])="Yes")) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM