Testing For Non-Null Strings

Some might test for Null by using

If sSomeString <> "" Then

or

If Len(sSomeString) = 0 Then

While these might work, it’s 50% faster to use

If IsNull(sSomeString) Then

Check out the other “Is” operators, IsDate, IsEmpty and IsNumeric. Use the correct operator for the job you have to do.

 

This tip is reprinted from the VB Tips & Tricks Volume 1 book.
Part of this tip was submitted by: Bobby Holstein

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s