Illegal use of Null Values !^&*$@^&*^$&* 
Author Message
 Illegal use of Null Values !^&*$@^&*^$&*

Hello all

I keep breaking my teeth on this error message when I try to pass to a
function a dynaset field that appears to be Null.
Let be more explicit. Creating a print routine (with the printer
object) from the content of a dynaset, it prints #NULL# is the value is
null which is not pretty. So I've made a routine NONULL (astring) as
string that is meant to return a blank in case astring is null.
But it doesn't go that far and keeps returning this "Illegal use of Null
Value" !!
I've tried to pass it by reference, by value, I've tried to slide it
under the door. NO WAY !

Anyone knows how to do that ?

thank a lot !



Wed, 24 Jun 1998 03:00:00 GMT  
 Illegal use of Null Values !^&*$@^&*^$&*
Hey, you're right.  Can't pass a null to a subroutine.  You might look into the
IIF function.  Here's an example of how it could help.  If rs!Date1 is a null,
then a blank will be printed, if not, then the date1 will be printed.

        Set rs = db.OpenRecordset("Table1", dbOpenSnapshot)

        Do Until rs.EOF
            Debug.Print IIf(IsNull(rs!Date1), "", rs!Date1)
            rs.MoveNext
        Loop

rs.Close


Quote:

>Hello all

>I keep breaking my teeth on this error message when I try to pass to a
>function a dynaset field that appears to be Null.
>Let be more explicit. Creating a print routine (with the printer
>object) from the content of a dynaset, it prints #NULL# is the value is
>null which is not pretty. So I've made a routine NONULL (astring) as
>string that is meant to return a blank in case astring is null.
>But it doesn't go that far and keeps returning this "Illegal use of Null
>Value" !!
>I've tried to pass it by reference, by value, I've tried to slide it
>under the door. NO WAY !

>Anyone knows how to do that ?

>thank a lot !



Thu, 25 Jun 1998 03:00:00 GMT  
 Illegal use of Null Values !^&*$@^&*^$&*

Quote:

>Hello all

>I keep breaking my teeth on this error message when I try to pass to a
>function a dynaset field that appears to be Null.
>Let be more explicit. Creating a print routine (with the printer
>object) from the content of a dynaset, it prints #NULL# is the value is
>null which is not pretty. So I've made a routine NONULL (astring) as
>string that is meant to return a blank in case astring is null.
>But it doesn't go that far and keeps returning this "Illegal use of Null
>Value" !!

One (rather kludgy, I'll admit) way around this null stuff is to
concatenate it with an empty string:

CallYourRoutine(ds!Field & "")

concatenating "" to the field ensures it won't be null.

--
Jim Gilbert                    Sub Disclaimer()

Monsanto Co.                      myOpinionsReflectMyEmployers = False
St. Louis, MO                  End Sub



Fri, 26 Jun 1998 03:00:00 GMT  
 Illegal use of Null Values !^&*$@^&*^$&*

Quote:

>Hello all
>I keep breaking my teeth on this error message when I try to pass to a
>function a dynaset field that appears to be Null.
>Let be more explicit. Creating a print routine (with the printer
>object) from the content of a dynaset, it prints #NULL# is the value is
>null which is not pretty. So I've made a routine NONULL (astring) as
>string that is meant to return a blank in case astring is null.
>But it doesn't go that far and keeps returning this "Illegal use of Null
>Value" !!
>I've tried to pass it by reference, by value, I've tried to slide it
>under the door. NO WAY !
>Anyone knows how to do that ?
>thank a lot !

Before passing/using/printing/operating upon.....a dbase field that
might possibly contain a NULL value you can safely check using
IsNull(RecordsetName("field_name"))

If this function returns TRUE then it is a NULL field...false
elsewise.

If you get a NULL true,  you can forward a dummy "empty" string
instead of the recordset's field into your routines,

regards,

Tony O'Brien
Sourcecode, Inc.



Fri, 26 Jun 1998 03:00:00 GMT  
 Illegal use of Null Values !^&*$@^&*^$&*

Quote:

>Hello all
>I keep breaking my teeth on this error message when I try to pass to a
>function a dynaset field that appears to be Null.
>Let be more explicit. Creating a print routine (with the printer
>object) from the content of a dynaset, it prints #NULL# is the value is
>null which is not pretty. So I've made a routine NONULL (astring) as
>string that is meant to return a blank in case astring is null.
>But it doesn't go that far and keeps returning this "Illegal use of Null
>Value" !!

I like to be tidy about sorting out VB type problems (Try Dephi,
you'll like it) so my "include this with everything" library has this
function:

function mkstring(s as variant) as string
        if isnull(s) then
                mkstring = ""
        else
                mkstring = s
        end if

Then, whenever I move data between variants and strings, i put
mkstring(foo).

Variants:What are they for? Why do we need them?

pointless, i know, if VB had typing, but...

Sid/



Sat, 27 Jun 1998 03:00:00 GMT  
 Illegal use of Null Values !^&*$@^&*^$&*

Quote:

>Variants:What are they for? Why do we need them?

I've got lots of code that has to be able to respond  to dynamically
generated query results - this kind of late binding would be a
nigyhtmare without variants
Quote:
>pointless, i know, if VB had typing, but...

 So 'pointless' in fact that one of Delphi 32's selling points is the
introduction of a 'new' variant data-type - maybe Borland know
something you don't.


Sun, 28 Jun 1998 03:00:00 GMT  
 Illegal use of Null Values !^&*$@^&*^$&*

Quote:


>>Variants:What are they for? Why do we need them?
>I've got lots of code that has to be able to respond  to dynamically
>generated query results - this kind of late binding would be a
>nigyhtmare without variants
>>pointless, i know, if VB had typing, but...
> So 'pointless' in fact that one of Delphi 32's selling points is the
>introduction of a 'new' variant data-type - maybe Borland know
>something you don't.

It couldn't possibly be that Borland want to try and convert more VB
programmers to Delphi could it?  ;-)


Tue, 30 Jun 1998 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. *&*&*&* Date math question *&*&*&*

2. ネットゲーム オセロ, インターネットのお金を稼ぐ, オンラインゲーム&#123

3. Help &&&&&& !!!!

4. how to call &&&.bat from outlook

5. Datagrid turns null value into  

6. IIf Statement & NULL value

7. How to avoid this &#%#$ null value?

8. Null Value problem in DAO & RDO

9. Using "CreateObject"

10. error using ADO (*%*%%(*^()*&)(*&^$##@

11. error using ADO (*%*%%(*^()*&)(*&^$##@

12. VB4&NT4 Illegal Proc. Call on FileCopy

 

 
Powered by phpBB® Forum Software