check if a field is null or empty

V

Vivi

Hello,

There is error when I launch this command:
rstExt.Fields(0).Value, because the field is empty, how can
I can check if a field is an empty one ?

Thanks

Regards
 
V

Van T. Dinh

* Command is probably a wrong term for this. You are referring to a value /
property so I guess what you posted rstExt.Fields(0).Value is only a portion
of a full VBA statement. Generally, it is quite OK to refer to a Null value
but it will be incorrect in other contexts, e.g. assigning the Null value to
a String / Long / etc ... variable.

I guess you need to post the context you are using rstExt.Fields(0).Value,
i.e. more related code.

* You should also post the error number / error message so that potential
respondents have more info. to go on.

* "Empty" could meant Null or zero-length String (2 different things
altogether) so you need to post the data type of Fields(0) also.

* Did you check for empty Recordset (zero row returned) before you referred
to the Recordset's Field value?
 
T

Troy

NZ() or IsNull()

Change the Null to whatever you want it to be:
If NZ(rstExt.Fields(0).Value,0) > 0 then

Check For Null
If Not IsNull(rstExt.Fields(0).Value) Then

--
Troy

Troy Munford
Development Operations Manager
FMS, Inc.
www.fmsinc.com


Hello,

There is error when I launch this command:
rstExt.Fields(0).Value, because the field is empty, how can
I can check if a field is an empty one ?

Thanks

Regards
 

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