Cannot save a null to an optional integer field in MDB
Cannot save a null to an optional integer field in MDB
I connected OOBase to an MS Access MDB file created from ODBC manager. Everything seems working fine except optional fields. I was able to design a database structure. But when editing a table data it does not let me leave an optional long integer blank.
Would anyone please suggest how can this be fixed?
Note: optional text fields work as expected
Would anyone please suggest how can this be fixed?
Note: optional text fields work as expected
OpenOffice 3.1 on Windows
aulix.com/openoffice-dot-net
aulix.com/openoffice-dot-net
Re: Cannot save a null to an optional integer field in MDB
When I create a table in MS Access with Base and do not specify a default value I can insert empty integer values as well. I tested via ODBC and via native ms access interface both. You talked about the design of a database structure, is data including multiple tables and relations between the tables? Are you trying to enter empty data into a Foreign Key field?
You might post your (stripped) MS access database file and Base document and tell about the table/field you have trouble with.
You might post your (stripped) MS access database file and Base document and tell about the table/field you have trouble with.
It's Microsoft marketing that tells you computers are qualified for non-technicians
W11 22H2 (build 22621), LO 7.4.2.3(x64)
W11 22H2 (build 22621), LO 7.4.2.3(x64)
Re: Cannot save a null to an optional integer field in MDB
It actually seems to be another problem: OOBase does not save "optional" (nullable) attribute for a field.
I reopened the database in the designer and fields are "required" again though I marked them as "not required".
Trying to save them as "not required" does not help.
The files have been attached.
I reopened the database in the designer and fields are "required" again though I marked them as "not required".
Trying to save them as "not required" does not help.
The files have been attached.
- Attachments
-
- test.7z
- test files
- (4.21 KiB) Downloaded 288 times
OpenOffice 3.1 on Windows
aulix.com/openoffice-dot-net
aulix.com/openoffice-dot-net
Re: Cannot save a null to an optional integer field in MDB
You are right. You can not change the property from NOT NULL to NULL. You can have columns with NULL values when you add them to the table as new columns or create the table from scratch. You can not make two changes to a table at a time and you can not rename a column. I noticed in the past that it is dangerous to make changes to MS Access via the table/relationship/view management of Base (Accept for creating a table). So make backup copies of database and Base. I normally do those changes with SQL statements via Tools -> SQL ... . So when you want to change a this property of column (C1) you have to:
- add a dummy column to the table
- copy the data from C1 to dummy
- drop the column C1
- add the column C1 (with 'Entry required = No')
- copy data from dummy to C1
It's Microsoft marketing that tells you computers are qualified for non-technicians
W11 22H2 (build 22621), LO 7.4.2.3(x64)
W11 22H2 (build 22621), LO 7.4.2.3(x64)
Re: Cannot save a null to an optional integer field in MDB
In my version of OOBase 3.1 NULLABLE attribute is not saved even if a new field is added. At the beginning it looks like a nullable but after restarting OOBase application and opening the ODB file with a link to the MDB file the field is not nullable anymore.eremmel wrote:You can have columns with NULL values when you add them to the table as new columns or create the table from scratch.
OpenOffice 3.1 on Windows
aulix.com/openoffice-dot-net
aulix.com/openoffice-dot-net
Re: Cannot save a null to an optional integer field in MDB
The only thing left is that you try to add a column via alter table syntax (see link in my previous post)
Note: I noticed that I can not empty a integer field on a nullable column when I open a table to edit it or via a form. But I can do it via SQL
You might consider to join the group of SQL programmers that hate the NULL and will never use it in their design...
Code: Select all
ALTER TABLE TestTable ADD COLUMN IntFieldwithNULL INTEGER;
ALTER TABLE TestTable ADD COLUMN IntFieldnoNULL INTEGER NOT NULL;
Code: Select all
update Table1 set i1=null where ID=3
It's Microsoft marketing that tells you computers are qualified for non-technicians
W11 22H2 (build 22621), LO 7.4.2.3(x64)
W11 22H2 (build 22621), LO 7.4.2.3(x64)
Re: Cannot save a null to an optional integer field in MDB
Null is convenient to have a "no reference" foreign key value.eremmel wrote:You might consider to join the group of SQL programmers that hate the NULL and will never use it in their design...
Btw, OOBase+PostgreSQL work fine with nulls, but I could not find an "under $50" design tool for database diagraming.
Does anybody aware of such a tool like http://www.microolap.com/products/datab ... -designer/
but priced under $50?
OpenOffice 3.1 on Windows
aulix.com/openoffice-dot-net
aulix.com/openoffice-dot-net
Re: Cannot save a null to an optional integer field in MDB
But NULL is as convenient as 0 or -1 or ... as no FK relation.
It's Microsoft marketing that tells you computers are qualified for non-technicians
W11 22H2 (build 22621), LO 7.4.2.3(x64)
W11 22H2 (build 22621), LO 7.4.2.3(x64)
Re: Cannot save a null to an optional integer field in MDB
Sometimes it is convenient to press del key to clear a reference in a record instead of typing in a predefined value like 0. Also corresponding 0 record should be explicitelly added to a table with a referenced primary key which is an additional work during prototyping a db design.eremmel wrote:But NULL is as convenient as 0 or -1 or ... as no FK relation.
OpenOffice 3.1 on Windows
aulix.com/openoffice-dot-net
aulix.com/openoffice-dot-net