Board index » delphi » MS Access "Required" and/or "Allow Zero-Length" AND Delphi TField.Clear
Travis Ahrens
![]() Delphi Developer |
Mon, 10 Dec 2001 03:00:00 GMT
MS Access "Required" and/or "Allow Zero-Length" AND Delphi TField.Clear
I have an MS Access .mdb which has many tables which have many "Text" fields
defined as "Required = No" and "Allow Zero Length = No". I have created a Delphi .exe to allow editing of these tables by using the DbCtrls, TDatasource, TQuery, and TDatabase. If a field contains non-blank data, and I attempt to update it to "empty", upon Posting, I get the error "Zero-Length not allowed". I tried trapping the OnChange event to set the TField of the Dataset to Null by using the TField.Clear method. I also tried simply setting TField.AsVariant = Null, with the same results. If I change the table definition to "Allow Zero-Length = Yes", everything works fine ... except I already have an MS Access UI which uses many queries which use IIF(IsNull(field)). I would like to avoid having to search through all the queries looking for these instances and changing them to IIF(IsNull(field) or field = ""). This seems to me to be a driver issue. I'm using the Native MSACCESS driver I would appreciate any information regarding this situation whether it be "a Thank you. |