Joel wrote:
I added a field to my company table (PBV_rstCompany.Fields("Installer")) the
default value of the field is Null. I place this If statement and it doesn't
work
Almost any expression involving a NULL yields a NULL as the value of the
expression. A NULL expression in a boolean condition such as your IF
works like FALSE for purposes of satisfying the condition.
In SQL, NULL is a state, not a value. You cannot compare NULL to
anything -- it will always yield NULL. The idea is that NULL represents
the absence of a value, or an unknown value, or a value that has not
been set yet. E.g., is my middle name "Kevin"? We cannot say for
sure--no value has been entered in the middle_name field yet.
If you must have a non-null state in your "Installer" field, then you
should delare it as a NOT NULL field in your schema, and perhaps also
give it a DEFAULT value. This is appropriate if you have a field that
_must_ be either "Y" or "N", and using NULL to indicate an absence of a
value is meaningless for that field.
Otherwise you must handle the case of a NULL state differently than
handling value comparisons. SQL provides a predicate IS [NOT] NULL,
which returns true or false.
Regards,
Bill K.