Run time error ’94’ Invalid use of Null

rotorque

Registered User.
Local time
Today, 16:12
Joined
Dec 17, 2008
Messages
53
I have managed to write some vb to write data from one table to another. However, it seems to stop with a message (Run time error ’94’ Invalid use of Null).

This specifically occurs at the point

strVariable= ![Field]

Is there away I can put a statement in to avoid the nulls. If I use an if statement in the form…

If Field=null then…. It doesn’t seem to work and carries over the value anyway.

Any suggestions please.
 
how about
Code:
if isnull(field) then
dont do anything 
else
[FONT=Arial][SIZE=3]strVariable= ![Field]
end if
[/SIZE][/FONT]
 
how about
Code:
if isnull(field) then
dont do anything 
else
[FONT=Arial][SIZE=3]strVariable= ![Field][/SIZE][/FONT]
[SIZE=3][FONT=Arial]end if[/FONT][/SIZE]

Ok Thanks. I'll give this a go.
 
Copied in your result and I got the same result. The strVariable= ![Field] was highlighted in yellow and the value is null.
 
Copied in your result and I got the same result. The strVariable= ![Field] was highlighted in yellow and the value is null.

It might not understand where ![Field] is pointing to. add the object in front of the ! and it will probably work. Is this reading from a form or something? If so then just change it to me.Field.value, then test for null before proceeding.
 
try

strVariable= nz([Field] ,vbnullstring)

why the ! ?
do you have a field called [field] ?

its not advised to use reserved words
 

Users who are viewing this thread

Back
Top Bottom