isNOTnull

  • Thread starter Thread starter rogers
  • Start date Start date
R

rogers

what function do you use (eg in an IIfmnested expression)
to discover if a textfield is NOT null?
 
You still use the IsNull() function e.g.

IIf(IsNull(variable), code for null, code for not null)

Hope This Helps
Gerald Stanley MCSD
 
IF Not IsNull([TextField]) THEN ...

However, I prefer to use:

IF Len([TextField] & "") > 0 THEN ...

which eliminate both Null and zer0-length String.

If you use imported data (which can have values with white spaces only),
use:

IF Len(Trim$([TextField] & "")) THEN ...
 
Typographical error.... should have been:

IF Len(Trim([TextField] & "")) THEN ...

(david)

Van T. Dinh said:
IF Not IsNull([TextField]) THEN ...

However, I prefer to use:

IF Len([TextField] & "") > 0 THEN ...

which eliminate both Null and zer0-length String.

If you use imported data (which can have values with white spaces only),
use:

IF Len(Trim$([TextField] & "")) THEN ...

--
HTH
Van T. Dinh
MVP (Access)




rogers said:
what function do you use (eg in an IIfmnested expression)
to discover if a textfield is NOT null?
 
--
HTH
Van T. Dinh
MVP (Access)


david epsom dot com dot au said:
Typographical error.... should have been:

IF Len(Trim([TextField] & "")) THEN ...

(david)

Van T. Dinh said:
IF Not IsNull([TextField]) THEN ...

However, I prefer to use:

IF Len([TextField] & "") > 0 THEN ...

which eliminate both Null and zer0-length String.

If you use imported data (which can have values with white spaces only),
use:

IF Len(Trim$([TextField] & "")) THEN ...

--
HTH
Van T. Dinh
MVP (Access)




rogers said:
what function do you use (eg in an IIfmnested expression)
to discover if a textfield is NOT null?
 
Actually, I did mean:

IF Len(Trim$([TextField] & "")) THEN ...

Trim returns a Variant (of String type) while Trim$ returns a String.

--
HTH
Van T. Dinh
MVP (Access)




david epsom dot com dot au said:
Typographical error.... should have been:

IF Len(Trim([TextField] & "")) THEN ...

(david)

Van T. Dinh said:
IF Not IsNull([TextField]) THEN ...

However, I prefer to use:

IF Len([TextField] & "") > 0 THEN ...

which eliminate both Null and zer0-length String.

If you use imported data (which can have values with white spaces only),
use:

IF Len(Trim$([TextField] & "")) THEN ...

--
HTH
Van T. Dinh
MVP (Access)




rogers said:
what function do you use (eg in an IIfmnested expression)
to discover if a textfield is NOT null?
 
Actually, I did mean:
???????


Len(Trim$([TextField]) & "")

returns a type conversion error for [TextField] is null


Len(Trim([TextField] & ""))

returns FALSE for [TextField] is null


If in some version of VBA "Trim$(Null)" returns an empty string, then
& ""
would not be required.

(david)


Van T. Dinh said:
Actually, I did mean:

IF Len(Trim$([TextField] & "")) THEN ...

Trim returns a Variant (of String type) while Trim$ returns a String.

--
HTH
Van T. Dinh
MVP (Access)




david epsom dot com dot au said:
Typographical error.... should have been:

IF Len(Trim([TextField] & "")) THEN ...

(david)

Van T. Dinh said:
IF Not IsNull([TextField]) THEN ...

However, I prefer to use:

IF Len([TextField] & "") > 0 THEN ...

which eliminate both Null and zer0-length String.

If you use imported data (which can have values with white spaces only),
use:

IF Len(Trim$([TextField] & "")) THEN ...

--
HTH
Van T. Dinh
MVP (Access)




what function do you use (eg in an IIfmnested expression)
to discover if a textfield is NOT null?
 
Ok, now (to late) I see _my_ error.

(david)

david epsom dot com dot au said:
Actually, I did mean:
???????


Len(Trim$([TextField]) & "")

returns a type conversion error for [TextField] is null


Len(Trim([TextField] & ""))

returns FALSE for [TextField] is null


If in some version of VBA "Trim$(Null)" returns an empty string, then
& ""
would not be required.

(david)


Van T. Dinh said:
Actually, I did mean:

IF Len(Trim$([TextField] & "")) THEN ...

Trim returns a Variant (of String type) while Trim$ returns a String.

--
HTH
Van T. Dinh
MVP (Access)




david epsom dot com dot au said:
Typographical error.... should have been:

IF Len(Trim([TextField] & "")) THEN ...

(david)

IF Not IsNull([TextField]) THEN ...

However, I prefer to use:

IF Len([TextField] & "") > 0 THEN ...

which eliminate both Null and zer0-length String.

If you use imported data (which can have values with white spaces only),
use:

IF Len(Trim$([TextField] & "")) THEN ...

--
HTH
Van T. Dinh
MVP (Access)




what function do you use (eg in an IIfmnested expression)
to discover if a textfield is NOT null?
 
Back
Top