Type mismatch problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kobamfo
    New Member
    • Sep 2012
    • 14

    Type mismatch problem

    Hello Guys,

    I have a form wherein if the value of lstatus (which is a combo text field input) is say "c" and another field named n_days which is a number field is greater than figure three (3)then I spit a message box.
    I have done so with the code below on Before Update of the form:

    Code:
    If ((lstatus.Value = "C") And (n_days.Value > 3)) Then
    Although it works once the conditions are satisfied, I get an error which says type mismatch when I try to refresh the form data or clear the form and set all values to Null ("").

    My VB is weak! What is the problem with my code?
    Kindly help.

    Warm Regards
    Kwesi
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    You've really not provided enough to work with however, the most common issues with null vs empty are:

    Nulls may not be used with a string datatype.

    Nulls may only be used with the variant datatype.

    "" is an empty string
    Null is null... an undefined entry
    The two are not interchangable.

    You might look at the NZ() function.

    You should also take a read thru Allen Browne Tutorial - Common Errors with Null

    Comment

    Working...