Discussion:
Null vs empty string
(too old to reply)
LAS
2010-08-23 17:16:42 UTC
Permalink
I have an unbound form where one text box is loaded with the
tblCodes.Description value where one set of tblCodes.Code and
tblCodes.Code_group obtains. And the other is loaded with the
tblCodes.Description value where a different set obtains. In other words,
each text box is filled with the same kind of data. When I highlight the
text box and press the Delete key, one of the text boxes ends up with a null
and the other ends up with an empty string. I can't find anything in the
property lists that seems to control this. Why do they behave differently?

TIA
LAS
John Spencer
2010-08-23 18:26:58 UTC
Permalink
I would expect that one field allows zero-length strings and the other does
not. The allow zero length string property is a field property in a table.

As far as I know textbox controls do not have this property.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Post by LAS
I have an unbound form where one text box is loaded with the
tblCodes.Description value where one set of tblCodes.Code and
tblCodes.Code_group obtains. And the other is loaded with the
tblCodes.Description value where a different set obtains. In other words,
each text box is filled with the same kind of data. When I highlight the
text box and press the Delete key, one of the text boxes ends up with a null
and the other ends up with an empty string. I can't find anything in the
property lists that seems to control this. Why do they behave differently?
TIA
LAS
LAS
2010-08-23 19:00:31 UTC
Permalink
They are unbound fields, but the values that are loaded into them with Set =
are from the same field (description) in the tblCodes table. That field
does allow zero length strings.
Post by John Spencer
I would expect that one field allows zero-length strings and the other does
not. The allow zero length string property is a field property in a table.
As far as I know textbox controls do not have this property.
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Post by LAS
I have an unbound form where one text box is loaded with the
tblCodes.Description value where one set of tblCodes.Code and
tblCodes.Code_group obtains. And the other is loaded with the
tblCodes.Description value where a different set obtains. In other
words, each text box is filled with the same kind of data. When I
highlight the text box and press the Delete key, one of the text boxes
ends up with a null and the other ends up with an empty string. I can't
find anything in the property lists that seems to control this. Why do
they behave differently?
TIA
LAS
David W. Fenton
2010-08-23 19:19:36 UTC
Permalink
Post by LAS
I have an unbound form where one text box is loaded with the
tblCodes.Description value where one set of tblCodes.Code and
tblCodes.Code_group obtains. And the other is loaded with the
tblCodes.Description value where a different set obtains. In
other words, each text box is filled with the same kind of data.
When I highlight the text box and press the Delete key, one of the
text boxes ends up with a null and the other ends up with an empty
string. I can't find anything in the property lists that seems to
control this. Why do they behave differently?
Description is a reserved word and I'd avoid using it as a field
name. I doubt that's the cause of the inconsistency, but I'd fix
that before I wasted any time on other troubleshooting tasks.

Are the underlying fields set to disallow zero-length strings? They
should be.
--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
LAS
2010-08-24 02:54:46 UTC
Permalink
It doesn't come into it, because

1) It's not a bound field.

2) Both fields get their data from the description column.
Post by David W. Fenton
Post by LAS
I have an unbound form where one text box is loaded with the
tblCodes.Description value where one set of tblCodes.Code and
tblCodes.Code_group obtains. And the other is loaded with the
tblCodes.Description value where a different set obtains. In
other words, each text box is filled with the same kind of data.
When I highlight the text box and press the Delete key, one of the
text boxes ends up with a null and the other ends up with an empty
string. I can't find anything in the property lists that seems to
control this. Why do they behave differently?
Description is a reserved word and I'd avoid using it as a field
name. I doubt that's the cause of the inconsistency, but I'd fix
that before I wasted any time on other troubleshooting tasks.
Are the underlying fields set to disallow zero-length strings? They
should be.
--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
David W. Fenton
2010-08-24 19:15:02 UTC
Permalink
Post by LAS
2) Both fields get their data from the description column.
Does reversing the order change it?

Frankly, I have very little interest in a problem like this, since
if you were doing things properly (i.e., disallowing ZLS) you
wouldn't be *able* to encounter it.

There is simply no justification for allowing ZLS in 99% of cases. I
see it as just lazy design (i.e., making your table design less
robust in order to save processing data to insure it doesn't include
ZLS's).
--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
LAS
2010-08-24 22:56:52 UTC
Permalink
What are ZLSs?
Post by David W. Fenton
Post by LAS
2) Both fields get their data from the description column.
Does reversing the order change it?
Frankly, I have very little interest in a problem like this, since
if you were doing things properly (i.e., disallowing ZLS) you
wouldn't be *able* to encounter it.
There is simply no justification for allowing ZLS in 99% of cases. I
see it as just lazy design (i.e., making your table design less
robust in order to save processing data to insure it doesn't include
ZLS's).
--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
Douglas J. Steele
2010-08-25 00:20:02 UTC
Permalink
Zero-Length Strings ("")
--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/djsteele
Co-author: "Access 2010 Solutions", published by Wiley
(no e-mails, please!)
Post by LAS
What are ZLSs?
Post by David W. Fenton
Post by LAS
2) Both fields get their data from the description column.
Does reversing the order change it?
Frankly, I have very little interest in a problem like this, since
if you were doing things properly (i.e., disallowing ZLS) you
wouldn't be *able* to encounter it.
There is simply no justification for allowing ZLS in 99% of cases. I
see it as just lazy design (i.e., making your table design less
robust in order to save processing data to insure it doesn't include
ZLS's).
--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
LAS
2010-08-25 00:25:33 UTC
Permalink
What should be there if there is no data?
What is a good value for "empty?"
Post by David W. Fenton
Post by LAS
2) Both fields get their data from the description column.
Does reversing the order change it?
Frankly, I have very little interest in a problem like this, since
if you were doing things properly (i.e., disallowing ZLS) you
wouldn't be *able* to encounter it.
There is simply no justification for allowing ZLS in 99% of cases. I
see it as just lazy design (i.e., making your table design less
robust in order to save processing data to insure it doesn't include
ZLS's).
--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
David W. Fenton
2010-08-25 19:14:19 UTC
Permalink
Post by LAS
What should be there if there is no data?
What is a good value for "empty?"
That's what Null is for.

Allen Browne has good articles on use of Null in Access (though the
principles apply generally to all databases and programming
languages):

Nulls: Do I need them?
http://allenbrowne.com/casu-11.html

Common Errors with Null
http://allenbrowne.com/casu-12.html

Nothing? Empty? Missing? Null?
http://allenbrowne.com/vba-NothingEmpty.html
--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
Loading...