469,072 Members | 1,844 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,072 developers. It's quick & easy.

Type mismatch problem

kobamfo
14
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:

Expand|Select|Wrap|Line Numbers
  1. 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
Aug 31 '13 #1
1 1130
zmbd
5,400 Expert Mod 4TB
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
Sep 1 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Arun Wadhawan | last post: by
2 posts views Thread by Søren M. Olesen | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.