Display if field is NOT "" or NOT null

Aleks
Aleks used Ask the Experts™
on
I have the following code which will display a region if a recordset field is not = ""  (blank)
I need to add to it that is also NOT null.

<% If rs_contactalert.Fields.Item("contact_alert_type").Value <> ""  Then 'script %>

REGION

 <% End If %>   

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
What is the database system? Why not solve it at the root itself? Add isnull(contact_alert_type, '') contact_alert_type in the select statement itself.

What do you think?

Author

Commented:
contact_alert_type  is the field of the recorset. if the field value is either NULL or ""  then the region won't be displayed. I am not clear what you are asking.
Okay...how is the recordset created? There must be a select statement somewhere if it is the kind of web applications I have been developing.
Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

Author

Commented:
its a simple select. I will change it so that if its NULL then it will make it ""  I can do that, but that was not the initial question for the IF statement.
Web Ninja at large
Commented:
to answer the original question, you can simply do

If  ( "" & rs_contactalert.Fields.Item("contact_alert_type").Value ) <> ""  Then

this will convert any NULL value into a string

Author

Commented:
Thanks. This is what I needed.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial