Microsoft: Access - Invalid Use of Null

Sam443

Senior member
Aug 22, 2000
204
0
0
I'm trying to get some of my variables contents copied from a form to a report. anyway I created a module with some global variables to hold the data temporarly...here is my problem.

In my form if I try to do something like

GlobalVariable1 = variable1

I get a Invalid Use of Null Error, I know why I get this error but I can't figure a way around it. (variable1 is NULL sometimes, because I wan't the field to be blank.)

I tried setting my global variables as Strings and then using "" instead of Null. but then my form's DO the calculations when its "", hence giving the wrong answers.
I would like to have it copy null values over to the report if the values are null in the form.

any ideas?

 

Oli

Member
Jul 20, 2000
98
0
0
Try to use some function who convert Null value to Empty value o declare your global variable as variant, because typed variable doesn't accept null.
Hope it help
 

Ladi

Platinum Member
Apr 21, 2000
2,084
0
0
Make sure the field isn't being required. Also, the calculations do need some provision for 'failing' or otherwise not completing (or ignoring) if the value is null. Can you substitute 0 for null?

~Ladi
 

Shazam

Golden Member
Dec 15, 1999
1,136
1
0
I'll slap you later.

AVOID NULLS LIKE THE PLAGUE.

You don't want nulls. What you want is either an empty string or zero, depending on your data type.

NULLS are only used if you absolutely, positively, don't know what should be in the field, NOT blank.

NULLS create a whole bunch of issues with queries that will be a headache for you later on.