null not null 
Author Message
 null not null

Hi,

I have a rather strange problem. I designed an app that should connect to
SQL server. On my SQL server, it runs fine, but when I tried it with a
customer's SQL, it crashes all of the time. The reason is that syntax like

If not MyRecordSource!MyField = null  then DoSomethingWithThatField
or
If not MyRecordSource!MyField = empty  then DoSomethingWithThatField

doesn't work anymore. If  MyRecordSource!MyField  is null, (I know it is,
because if I let the mouse hoover over it, the tooltip says so) , the code
still jumps to the then-clause.

One other strange difference I've noticed, is that in my version of SQL
server, fields with no values are displayed as empty fields in the manager,
and in my customer's version, they say <NULL> . We  both run SQL server 7.0

Any ideas anyone? Thanks in advance.



Sat, 08 Dec 2001 03:00:00 GMT  
 null not null
If a=null then...
this is invalid test
You need to use isnull function as any statement with null is evaluated
to NULL
I have not checked code, but if something = Null then...
definitely not correct use of NULL
Good luck

Quote:

> Hi,

> I have a rather strange problem. I designed an app that should connect to
> SQL server. On my SQL server, it runs fine, but when I tried it with a
> customer's SQL, it crashes all of the time. The reason is that syntax like

> If not MyRecordSource!MyField = null  then DoSomethingWithThatField
> or
> If not MyRecordSource!MyField = empty  then DoSomethingWithThatField

> doesn't work anymore. If  MyRecordSource!MyField  is null, (I know it is,
> because if I let the mouse hoover over it, the tooltip says so) , the code
> still jumps to the then-clause.

> One other strange difference I've noticed, is that in my version of SQL
> server, fields with no values are displayed as empty fields in the manager,
> and in my customer's version, they say <NULL> . We  both run SQL server 7.0

> Any ideas anyone? Thanks in advance.

--



Sat, 08 Dec 2001 03:00:00 GMT  
 null not null
You can't use

If <variable> = NULL

since _nothing_ can ever equal NULL. You must use:

If IsNull(variable) ...

to do what you want. Why the old code ever worked for you I have no idea, it
shouldn't have.



Quote:
> Hi,

> I have a rather strange problem. I designed an app that should connect to
> SQL server. On my SQL server, it runs fine, but when I tried it with a
> customer's SQL, it crashes all of the time. The reason is that syntax like

> If not MyRecordSource!MyField = null  then DoSomethingWithThatField
> or
> If not MyRecordSource!MyField = empty  then DoSomethingWithThatField

> doesn't work anymore. If  MyRecordSource!MyField  is null, (I know it is,
> because if I let the mouse hoover over it, the tooltip says so) , the code
> still jumps to the then-clause.

> One other strange difference I've noticed, is that in my version of SQL
> server, fields with no values are displayed as empty fields in the
manager,
> and in my customer's version, they say <NULL> . We  both run SQL server
7.0

> Any ideas anyone? Thanks in advance.



Sun, 09 Dec 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Alter Table with NULL/NOT NULL options

2. When is Null not Null

3. Null Null Null!!!!!!!!!

4. Null, Null, Null!

5. double null question [2 * Null = Null] !!!

6. Null = Null Not Working ?

7. To Null, or not to Null...?

8. To Null, or not to Null...?

9. Null = Null error

10. null in vb and null in sql7

11. How can I pass NULL value to WinAPI which is expecting a NULL pointer

12. IS NULL vs = NULL - ODBC Drivers

 

 
Powered by phpBB® Forum Software