What is wrong with this VBA CODE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • steve1d
    New Member
    • Mar 2014
    • 1

    #1

    What is wrong with this VBA CODE

    What is wrong with the following code :
    Code:
    If C.SentOn <> "" Then
    It keeps erroring. The same code runs perfectly in other modules.
    Last edited by NeoPa; Mar 15 '14, 06:57 PM. Reason: Added [CODE] tags punctuation and spelling etc.
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    If C.SentOn is null, then you will get an error because you can't compare null to anything. If this is the problem, then the fix would be
    Code:
    If C.SentOn & "" <> "" Then
    By concatenating a zero-length string to C.SentOn, you make it not null without changing the value that you are comparing.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      I'm sure if the code errors then it will give number and description information about the particular error. This essential information is missing from your question for some reason.

      Comment

      Working...