How Do I Correct a Zero-Length string error?

I cannot figure out a Zero-String error on my web page. I am using an Access database for my Table and the Web page is an ASP page.
Below is the error message along with the line of code for the desired records. In the code, how do I correct the 'City" field.?
If the user does not enter anything in the field, the field should respond with a blank display.

Thank you for any help!

insert into CAR (EditBy,Status,DateIssued,[Issued by],Title,Company,Contact,Phone,Fax,Email,Manufacturer,[Part Number],[ESC ID],PO,RMA,[Quantities Affected],[Description of Nonconformance],Containment,[Root Cause],CandP,[Corrective Action Date],[Due Date],[Reference Number],Address1,Address2,City,State,Zip,CityStateZip,Quan1,Lot1,Quan2,Lot2,Quan3,Lot3,Branch,ClosedDate,CompletedBy,ToFrom,ReviewOfEffectiveness) values ('BECKYS','Closed',NULL,'BECKYS','','','','','','','','','','','','','','','','',NULL,NULL,'','','','','','','','','','','','','','',NULL,'BECKYS','From: ES Components',NULL)
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Field 'CAR.City' cannot be a zero-length string.
/AllCARAdds.asp, line 79

var MM_fieldsStr = "select1|value|select2|value|DateIssued|value|select3|value|Title|value|Company|value|Contact|value|Phone|value|Fax|value|Email|value|Manufacturer|value|PartNumber|value|ESCID|value|PO|value|RMA|value|QuantityAffected|value|Nonconformance|value|Containment|value|RootCause|value|CandP|value|CorrectiveActionDate|value|DueDate|value|ReferenceNumber|value|Address1|value|Address2|value|City|value|State|value|Zip|value|CityStateZip|value|Quan1|value|Lot!|value|Quan2|value|Lot2|value|Quan3|value|Lot3|value|Branch|value|CloseDate|value|select4|value|select5|value|ReviewofEffectiveness|value";
  var MM_columnsStr = "EditBy|',none,''|Status|',none,''|DateIssued|',none,NULL|[Issued by]|',none,''|Title|',none,''|Company|',none,''|Contact|',none,''|Phone|',none,''|Fax|',none,''|Email|',none,''|Manufacturer|',none,''|[Part Number]|',none,''|[ESC ID]|',none,''|PO|',none,''|RMA|',none,''|[Quantities Affected]|',none,''|[Description of Nonconformance]|',none,''|Containment|',none,''|[Root Cause]|',none,''|CandP|',none,''|[Corrective Action Date]|',none,NULL|[Due Date]|',none,NULL|[Reference Number]|',none,''|Address1|',none,''|Address2|',none,''|City|',none,''|State|',none,''|Zip|',none,''|CityStateZip|',none,''|Quan1|',none,''|Lot1|',none,''|Quan2|',none,''|Lot2|',none,''|Quan3|',none,''|Lot3|',none,''|Branch|',none,''|ClosedDate|',none,NULL|CompletedBy|',none,''|ToFrom|',none,''|ReviewOfEffectiveness|',none,NULL";
Who is Participating?
_agx_Connect With a Mentor Commented:
In addition to what Lee said, looks like the "wizard" code replaces "none" with an empty string. So you'd have to search the delimited MM_fieldsStr  variable again, find the "city" and replace none with some other default value like N/A.

             var MM_fieldsStr = "Status|value|........|City|',none,''|

BTW, this kind of stuff demonstrates why wizard generated code is both a blessing an a curse (...when you need to change things).
Lee W, MVPTechnology and Business Process AdvisorCommented:
It sounds like city is a required field but you are not validating the data. I'd validate there is data in the field (if Len(CAR.CityDataVariable) < 1 Then ...)

If you don't care about there being data in the field, then change the field requirements so it can be empty or null.

If you don't want to do it the right way with one of the two options above, then just do a check and alter the value programmatically so that if the len < 1 then the variable = "N/A" or something like that.
ES-ComponentsAuthor Commented:
AGX solved the problem. I also found out that by going into the Access database table in the City field, just change the default setting to
allow Zero-String. Thanks AGX for your help!!!!!
Glad you got it working. Just for the record, the other half of the solution (altering the database table) was Lee W, MVP's suggestion, so for next time a split would be appropriate :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.