[Solved] Can't enter ANY data after creating DBase

Discuss the database features
Post Reply
THEBookMan
Posts: 107
Joined: Wed Sep 30, 2015 10:03 pm
Location: Houston, TX area

[Solved] Can't enter ANY data after creating DBase

Post by THEBookMan »

I Taught MS Access (loved it) a few years ago.

I just created a DBase table, Form, Report and query.Piece of cake!

I just spent 3 hours reading tutorials on OODbases.

I can't find how to enter data into table via form (table form or field boxes form) or directly into table!

I must be an id10t.

Pls help.

TNX in advance,
⌡im
Last edited by THEBookMan on Mon Jun 25, 2018 5:34 pm, edited 1 time in total.
Open Office 4.1.3 Win 10
UnklDonald418
Volunteer
Posts: 1546
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Can't enter ANY data after creating DBase

Post by UnklDonald418 »

The most likely cause of your problem is that you didn't designate a Primary Key when you set up your table(s). The HSQLDB database engine used by Base requires all tables to have a primary key field. It is usually best to use an Auto generating field.

Right click on your table and select Edit.
Does it have a Field Name of ID?
If it does, is there a little yellow key icon to the left of the Field Name? If not right click and select Primary Key.
If it shows a little yellow key icon, make sure Auto Value is set to Yes in the lower area of the window.
If it doesn't have an field named ID then the easiest way to add it is to go to Tools>SQL first edit and then execute the following command.

Code: Select all

ALTER TABLE "YourTableName" ADD COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(start with 0) PRIMARY KEY;
Then select View>Refresh Tables.
You should be able to now enter data directly into the table.
In order to enter data on a Base form it requires a Formatted Field control using ID as its Data field. If it is Auto generating the control can have its Visible property set to No, but it must still exist on the form so the database engine knows which record to change.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
THEBookMan
Posts: 107
Joined: Wed Sep 30, 2015 10:03 pm
Location: Houston, TX area

Re: Can't enter ANY data after creating DBase

Post by THEBookMan »

Ran: ALTER TABLE "tblMain" ADD COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(start with 0) PRIMARY KEY;
DBase returned: 1: Column constraints are not acceptable in statement [ALTER TABLE "tblMain" ADD COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(start with 0) PRIMARY KEY]
Added field "ID and made primary, (integer)
Ran: ALTER TABLE "tblMain" ADD COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(start with 0) PRIMARY KEY;
DBase returned: 1: Column already exists: ID in statement [ALTER TABLE "tblMain" ADD COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(start with 0) PRIMARY KEY]

Thanks,
⌡im
Open Office 4.1.3 Win 10
UnklDonald418
Volunteer
Posts: 1546
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Can't enter ANY data after creating DBase

Post by UnklDonald418 »

Added field "ID and made primary, (integer)
In that case all you should need to do is set AutoValue to Yes in the Table Design dialog. Then you should be able to add/edit data directly into the table using Table Data View (double click on the table name).
As mentioned earlier to enter data on a form the form must have a Formatted Field control using ID as the Data field.

If you continue having problems then upload your database using Upload attachment near the bottom of the forum message entry/edit page so someone can see what might be happening.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
THEBookMan
Posts: 107
Joined: Wed Sep 30, 2015 10:03 pm
Location: Houston, TX area

[SOLVED]Can't enter ANY data after creating DBase

Post by THEBookMan »

THAT DID IT!

Simple.....Yet illusive.

Thanks,
⌡im
Open Office 4.1.3 Win 10
Post Reply