Skip to main content

Search

Search

Wildcard

Comments

3 comments

  • Avatar
    Legacy Poster

    To do this I normally use the "InStr()" VB function.

     

    http://msdn.microsoft.com/en-us/library/8460tsh1

     

    Format can be used like:

    if (InStr(data, "ABC") > 0) then
    ...
    end if
    

    if the "ABC" is found inside data, then the InStr will return greater than 0. If it is not found, it will return 0.

    0
  • Avatar
    Legacy Poster

    Hi 

     

    Thank you so much for your help... it worked.  

     

    I do have another question which I am hoping you can help me with.

     

    I now have to add a condition to evaluate if another field is blank.  I have tried both IsNull and IsEmpty.  I know for with complete certainty that the field is blank... there is nothing.  I have tried:

     

    If (InStr(SD1, "ABC") > 0) and IsEmpty(SD3) then

     

    but it just wont evaluate the IsEmpty?

     

    Any idea what I am doing wrong.

     

    Thanks.

    Nicky

    0
  • Avatar
    Fernando Ramos Miracle

    Hello NickySA,

     

    I would first recommend trying the "IsEmpty()" condition by itself to see if it really is not working.

     

    Also please make sure that the field is truly empty (no space characters for example).

     

    Another possibility to test if a field is empty is to compare it with [""]:

     

     

    If SD1 = "" Then
    ...
    End If
     

     

    Also, please make sure to properly reference named data sources and database fields:

     

    - Field("<DatabaseName>.<FieldName>")

    - Format.NamedSubStrings("<DataSourceName").Value 

     

    You can load their value on a variable if it's too cumbersome to use the full reference each time.

     

    Finally, you can try adding a "MsgBox()" command before the actual "If" statements to get a prompt of the value you are trying to verify. This can help you find where the problem might be:

     

     

    MsgBox(SD1)
    If SD1 = "" Then
    ...
    End If
     

     

    Regards

    0

Please sign in to leave a comment.