Allow Null?

  • Thread starter Thread starter HM
  • Start date Start date
H

HM

Hello,
I suing MSAccess2K update on a link table then I get an
error message :
"Run-time error 94 - Invalid use of Null"
Here my short code:
.....
x1 = Rs1!notask
....
field notask is null but I want to assign this to x1.
How can I do this.
Any help - Thanks.
HM
 
HM said:
Hello,
I suing MSAccess2K update on a link table then I get an
error message :
"Run-time error 94 - Invalid use of Null"
Here my short code:
....
x1 = Rs1!notask
...
field notask is null but I want to assign this to x1.
How can I do this.
Any help - Thanks.
HM

If x1 is declared as a Variant, then it can receive a Null value. If
not, use the Nz() function to transform a Null value to a substitute
value that is suitable for the data type of x1. For example,

Dim x1 As Long
' ...
x1 = Nz(Rs1!notask, 0)

or

Dim x1 As String
' ...
x1 = Nz(Rs1!notask, "")
 
Hi Dirk,
Bigggg Thanks. You are so helpful! :-)
HM
-----Original Message-----


If x1 is declared as a Variant, then it can receive a Null value. If
not, use the Nz() function to transform a Null value to a substitute
value that is suitable for the data type of x1. For example,

Dim x1 As Long
' ...
x1 = Nz(Rs1!notask, 0)

or

Dim x1 As String
' ...
x1 = Nz(Rs1!notask, "")

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
Back
Top