To read the article online, visit http://www.4GuysFromRolla.com/webtech/031699-1.shtml

Poor Man's IsNull
By Tim Sullivan


If all you want to see is if the variable is "blank", try using this nifty function instead of messing around with "IsNull".


function PoorMansIsNull(str)
	Dim blankStr
	blankStr = trim("" & str)

	if blankStr = "" then
		PoorMansIsNull = True
	else
		PoorMansIsNull = False
	end if
end function

The ("" & ) before the request variable forces VB to convert NULLS to blank strings. Maybe a little more overhead, but much easier to code and understand. You can use this nifty little function to determine if form fields are blank or not. For example, if you wanted to tell if the user entered his or her name in a field in a form, you could write the following code:

If PoorMansIsNull(Request("txtName")) then
	Response.Write("You didn't enter your name!")
else
	Response.Write("Thanks for entering your name.")
end if

Enjoy!


Article Information
Article Title: Poor Man's IsNull
Article Author: Tim Sullivan
Published Date: Tuesday, March 16, 1999
Article URL: http://www.4GuysFromRolla.com/webtech/031699-1.shtml


Copyright 2017 QuinStreet Inc. All Rights Reserved.
Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers