[Solved] New database

Discuss the database features
Post Reply
watmanh
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm

[Solved] New database

Post by watmanh »

i created a database and a table but could not add data. created a form for the table but still could not add data. database, table and form all show in respective windows. what am I missing?
Last edited by watmanh on Wed Feb 22, 2017 6:39 pm, edited 3 times in total.
open office 4.1.3 on windows 10
UnklDonald418
Volunteer
Posts: 1544
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: New database

Post by UnklDonald418 »

Does your table have a Primary Key that Auto Increments?
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
watmanh
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm

Re: New database

Post by watmanh »

i dont have a primary key. will try to figure out how to add one or redo it since it is a small table and no data will be lost for sure
open office 4.1.3 on windows 10
UnklDonald418
Volunteer
Posts: 1544
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: New database

Post by UnklDonald418 »

Spreadsheets use Row numbers to differentiate data rows.
Databases require a unique Primary Key in order to differentiate the data rows.
Go to Tools->SQL and edit and enter the following SQL command

Code: Select all

ALTER TABLE "YourTableName" ALTER COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY;
it will add a proper Primary Key to your table.
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
watmanh
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm

Re: New database

Post by watmanh »

got status msg

1: Primary key not allowed in statement [ALTER TABLE "track" ALTER COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY]
open office 4.1.3 on windows 10
watmanh
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm

Re: New database Solved

Post by watmanh »

thank you, had to redo the id field.
open office 4.1.3 on windows 10
watmanh
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm

Re: New database

Post by watmanh »

i was successful in adding a key but thought problem solved before i tried to enter data. forms created for table dont let me add row
open office 4.1.3 on windows 10
UnklDonald418
Volunteer
Posts: 1544
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: New database

Post by UnklDonald418 »

The Primary Key must be on your form. If you don't want to see the Primany Key while entering data on your form you can hide it.
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
watmanh
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm

Re: New database solved

Post by watmanh »

thanks much
open office 4.1.3 on windows 10
Post Reply