'Testing for a null string
If strA = vbNullString Then
     'If it's a null (empty) string, do something
Else
   'The variable contains data and can be manipulated
     Msgbox strA
End If


'Testing for an empty variable of any type
If IsEmpty(varA) = True Then
     'If it's an uninitialized variable do something
Else
   'The variable contains data and can be manipulated
     Msgbox varA
End If


'Testing for a valid Object
If objField Is Nothing Then
     'Object doesn't exist
     Exit Sub
End If

--- In [EMAIL PROTECTED], "elriba75" <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Given a variable, for example FieldA, I need to do the following:   if
> the variable is NOT empty, I want to return a string, but if it is
> empty, return nothing:
>
> Something like:
>
>   If FieldA Then
>      return "FieldA = " & FieldA
>   Else
>      return ""
>   End If
>
> I have a bunch of these variables, and I want to build a string such
as:
>
> "FieldA = " & FieldA & "," & "FieldB = " & FieldB
>
> But only including those which have values.
>
> Any ideas on how to do this?
> Best regards,
> Edgard
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nsb-ce" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nsb-ce?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to