NZ(me.thisfieldhasnovalue,”Evaluating Nulls”)

Using NZ does ONE evaluation step which gets the data you requested from a field or formula (if it is NOT null), otherwise it will pass in a new value to use in it’s place so the formula or expression does not break due to a NULL.  This is required in a lot of scenarios due to the fact you can not evaluate “nothing” to determine a required outcome.


if nz(me.fname,0) <> 0 then

    msgbox “Hello ” & fname


    msgbox “You do not have a first name”.

end if

or another example I would use in a group by query for product sales,

this would be the query column formula:

NewItemCost: nz(me.itemcost,0))

In the last example if itemcost was left blank the sum formula would have failed because you can’t sum NULL plus values.  but you CAN sum 0 plus values.  So now I can do a group by on this query, or a sum on that new field I created.  Without the NZ I can not.  The real problem is allowing NULLS on a cost field.  one should default in 0 and force a value in the property of the field on the form, by using a validation setting of “Is Not Null”.  You can also do defaults at the table level, but I rarely endorse that .  I like all formulas and defaults and settings done at forms, unless it is the primary key, a timestamp, or a bit field.  once in a while I default values for number or text fields on tables, but I find this permanently binding so I prefer to do the default at a form level.

Happy databasing!

Follow me on twitter if you aren’t already!   @jhshirley

Jeff Shirley

Jeff Shirley

Founder & CEO
Jeff brings over 27 years of experience to the table, along with numerous awards, certifications, and real-world implementations.  His database solutions are currently running in industries including government, mining, agriculture, finance, education, science, research, non-profits, and healthcare businesses around North America and serve thousands of users day to day.  Jeff is a five-time MVP Award recipient for Microsoft Access, acknowledging contributions to community projects, evangelism, and educational outreach on Microsoft technologies.  Today there are less than 50 Access MVP’s worldwide. While Jeff focuses day to day on business management, IoT development, IT integrations and design, database architecture or other typical complex tasks, he also is a co-owner of Blue Heron Gardens, a commercial apiary running over 200 beehives.  Fresh honey is a small perk for many of our clients!

Mitch Redekopp

Mitch works with our clients day to day ensuring web development and IT projects are done to exceed customer expectations.  His background includes formal training in IT, Microsoft and CompTIA certifications, real-world business experience, and a true dedication to ensuring clients receive timely and professional support on their projects with Rivercity Technology Services.  Given the most difficult requests for IT solutions, Mitchell can assist our clients in finding a path to the best options which deliver results for our clients.  Mitchell is an avid soccer player and Manchester City fan, be sure to talk soccer with him when you can.