MS Access Question: how to use function to locate Blank record
I would like to use following function to locate Blank record
Blank: IIf(InStr([table],"")<>0,"Blank")
However it locates all not null record as "Blank"
Please advise.
Microsoft Access
Last Comment
PatHartman
8/22/2022 - Mon
Daniel Pineault
What constitutes a blank record? A record where all the fields are NULL? You could easily create a query for this, no?
I think you will need to explain your table structure and data more in detail.
Also, why not setup your table structure so you don't have blank records?
Hiro 714
ASKER
Thank you, Daniel.
Blank record means Null and "" record.
Table has a field in short text, contains Null and ""
I want to create a query if the record is Null or "", then return "Blank" string
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
Because Nz() works differently in VBA than it does in SQL as well as differentiating between string and non-string data types. I'm assuming that your field is a text data type otherwise it makes no sense at all to return "blank".
In this particular case, assuming you are working with a text data type, omitting the substitution value and allowing it to default will end up OK but most people have never read the help entry for Nz() and don't understand that the default may not be what they expect in certain situations so I recommend always specifying what result you want returned. Rely on defaults at your own peril. The really scary part of this particular default is that the function works differently in VBA than in SQL. By always providing the result value, I avoid having to remember to consider the what environment the expression will be evaluated by and does that impact the result I expect.
I think you will need to explain your table structure and data more in detail.
Also, why not setup your table structure so you don't have blank records?