Tring to not get and error when null is received from Recordset

I have a record set that returns nulls in one of the fields.  The nulls are expected.  However I keep getting and error in the following code when a null is passed to the if then statement.  How do I keep for getting the null and choosing between the different types of greetings?

------------------------------------

        emailSalutation = emailSalutation & "         <table width=600 border=1 cellpadding=10>" & vbCrLf
        emailSalutation = emailSalutation & "             <tr>" & vbCrLf
        emailSalutation = emailSalutation & "                 <td align='left'>" & vbCrLf
        If Len(rsEmailList("fldFirstName").Value) > 1 Then
            emailSalutation = emailSalutation & " <p>Dear " + rsEmailList("fldFirstName").Value + ",</p>"
        Else
            emailSalutation = emailSalutation & " <p>Dear Patron,</p>"
        End If
        emailSalutation = emailSalutation & "                 </td>" & vbCrLf
        emailSalutation = emailSalutation & "             </tr>" & vbCrLf
        emailSalutation = emailSalutation & "           </table>" & vbCrLf


-----------------------------------------------------------

thank you
Richard ComitoDirector of ITAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nouloukCommented:
Hi Gabicus,

what is exactly the error message ?
try:
If (Not rsEmailList("fldFirstName").IsNull) Then
      If Len(rsEmailList("fldFirstName").Value) > 1 Then ...

Hope this helps.
0
slyckboyCommented:
Try
if not isdbnull( rsEmailList("fldFirstName")) then ...

this works with datatables/datasets, i assume it will treat recordsets the same, curious to know.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richard ComitoDirector of ITAuthor Commented:
Hi noulouk,

this is the error that I am getting:

An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll

Additional information: Type mismatch.

I tried what gave me but I get the error "isNull" is not a member of the ADODB.field

0
Richard ComitoDirector of ITAuthor Commented:
Well slyckboy it works with recordset also.

Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.