Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Cannot be a zero-length string Error - Microsoft JET Database Engine (0x80040E21)


Message #1 by ajayvarma1@a... on Tue, 4 Dec 2001 17:06:46
Hello,



I have a registration form defined.  Upon pressing the submit button the 

user is taken to a confirmation page after the information is written to 

the database record in Access.



The problem that I am running into is if the user does not fill-in all 

fields of the form the following error type occurs on the unfilled-in 

fields:



Error Type:

Microsoft JET Database Engine (0x80040E21)

Field 'PatientInfo.apt' cannot be a zero-length string.

/AddPatient.asp, line 114





My database table is set-up so that no fields (except for the primary key 

field in the table) are required fields.



Any idea on why this is happening and how to fix it?



Thanks.   



Message #2 by "Zee Computer Consulting" <zee@t...> on Tue, 4 Dec 2001 14:41:35 -0800
You could try adding a space to each string before saving, for example, if

AptCode holds the text typed on the form:



    AptCode = AptCode & " "



This prevents trying to save a zero-length string to a field, but still

results in a blank field.



-- Z









----- Original Message -----

From: <ajayvarma1@a...>

To: "Access ASP" <access_asp@p...>

Sent: Tuesday, December 04, 2001 5:06 PM

Subject: [access_asp] Cannot be a zero-length string Error - Microsoft JET

Database Engine (0x80040E21)





> Hello,

>

> I have a registration form defined.  Upon pressing the submit button the

> user is taken to a confirmation page after the information is written to

> the database record in Access.

>

> The problem that I am running into is if the user does not fill-in all

> fields of the form the following error type occurs on the unfilled-in

> fields:

>

> Error Type:

> Microsoft JET Database Engine (0x80040E21)

> Field 'PatientInfo.apt' cannot be a zero-length string.

> /AddPatient.asp, line 114

>

>

> My database table is set-up so that no fields (except for the primary key

> field in the table) are required fields.

>

> Any idea on why this is happening and how to fix it?

>

> Thanks.

>

>




>



Message #3 by "Ken Schaefer" <ken@a...> on Wed, 5 Dec 2001 15:36:01 +1100
What does your database design specifications call for (you do have

specifications don't you?)



a) If you require this field to have a value, then require the users to

enter one

b) If you allow NULLs, then create your SQL statement so that a NULL is

entered, rather than ""

c) If you want to allow zero-length strings, then change the database design

in Access.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: <ajayvarma1@a...>

To: "Access ASP" <access_asp@p...>

Sent: Tuesday, December 04, 2001 5:06 PM

Subject: [access_asp] Cannot be a zero-length string Error - Microsoft JET

Database Engine (0x80040E21)





: Hello,

:

: I have a registration form defined.  Upon pressing the submit button the

: user is taken to a confirmation page after the information is written to

: the database record in Access.

:

: The problem that I am running into is if the user does not fill-in all

: fields of the form the following error type occurs on the unfilled-in

: fields:

:

: Error Type:

: Microsoft JET Database Engine (0x80040E21)

: Field 'PatientInfo.apt' cannot be a zero-length string.

: /AddPatient.asp, line 114

:

:

: My database table is set-up so that no fields (except for the primary key

: field in the table) are required fields.

:

: Any idea on why this is happening and how to fix it?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




  Return to Index