Allow Null?

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
 
D

Dirk Goldgar

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, "")
 
H

HM

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)


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top