Board index » delphi » Zero-length string

Zero-length string

Recently converted a desktop application from BDE/pdox tables to ADO/Access.
My client is complaining that when they blank out a text field (that
previously had data in it), a message displays saying " 'Table1.Field1'
cannot be a zero-length string ".  This is similar to a problem I had with
Locate.  In this case Field1 is defined to Access as a Text field of length
255.  Why do I get this message?  Do I have to trap for zero length strings
for each of my text fields??

Joe

 

Re:Zero-length string


Access' fields have a property "Allow Zero Length" and its default is FALSE.
You should set the property = True to allow ZeroLength string (text) fields.

Pierre

Re:Zero-length string


Actually, that's going to depend on the business rules. If it's a required
field, then it's a required field, and you need to validate it. If it CAN be
"empty" you can also append a space " " to it before writing.
MikeR
"Pierre du Parte" <pie...@finalfiler.com> wrote in message
news:87bko9$3dj15@bornews.borland.com...
Quote
> Access' fields have a property "Allow Zero Length" and its default is
FALSE.
> You should set the property = True to allow ZeroLength string (text)
fields.

> Pierre

Re:Zero-length string


You could also use the BeforePost Event of the dataset to check for
zero length strings and the use the field's clear method to set it to
null. This is what Access itself seems to do when you "clear" a field
that has it's Allow Zero Length String set to false.

hth
Marjan

On Thu, 3 Feb 2000 21:28:23 +1100, "Pierre du Parte"

Quote
<pie...@finalfiler.com> wrote:
>Access' fields have a property "Allow Zero Length" and its default is FALSE.
>You should set the property = True to allow ZeroLength string (text) fields.

>Pierre

Re:Zero-length string


You have to set the Allow Zero Length String property of the text field to
True in Access. The default is False.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Re:Zero-length string


Hi,
I was stating the simplest solution, ie if the customers are entering zero
length fields then set the field's property accordingly.

But I agree that the "business rules" should determine the action.

Pierre

Other Threads