View Full Version : Dealing with null values in textboxes


Voltron
07-27-2009, 07:59 AM
This code is for anyone who is new to VBA and/or Access and is not sure how to deal with null values in their textboxes. This code changes the null values of the First Name and Last Name textboxes to empty strings. If you don't want an empty string then you need to do some KeyPress event procedure coding.

Dim s_First As String
Dim s_Last As String

s_First = Nz([txt_First_Name], "")
s_Last = Nz([txt_Last_Name], "")

txt_First_Name = s_First
txt_Last_Name = s_Last