[Solved] Adding/editing data

Creating tables and queries
Post Reply
paulb
Posts: 6
Joined: Fri Dec 05, 2008 6:06 pm

[Solved] Adding/editing data

Post by paulb »

I have just started experimenting with the database. Have created a table, a query and a form tied to the query. Have added some data into the table. When I open the form it will not allow me to add or edit data to an existing record. What control have I not set correctly to allow new/edit old data in a record?

Thanks

Paul
Last edited by paulb on Mon Dec 08, 2008 10:01 pm, edited 1 time in total.
OOo 2.3.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: adding/editing data

Post by Villeroy »

First, what type of database is indicated in the status bar? HSQL?
Right-click the form and "Edit..."
View>Toolbars>Form Design
Push 5th button "Form Navigator" and get the properties of the form.
What is the content of tab "Data"?
In case of some table: Is the table editable when you open it directly? (does it have a primary key)
In case of a stored query: Is the stored query editable when you open it directly? (that depends on several preconditions)
In case of an SQL-string (a query stored within the form): Push the [...] button next to the SQL string and the test-button (green check-mark) in order to see the query result in a grid view. Is that editable?

You can view any query in SQL view ("database command line") and paste the string into this forum.

If the form's underlying record set is editable: There are also restrictions on form level accessible on the same properties dialog ("allow modification", "allow deletion", "allow new records",...)
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
paulb
Posts: 6
Joined: Fri Dec 05, 2008 6:06 pm

Re: Adding/editing data

Post by paulb »

Type of database - HSQL

On Form data tab -
Content Type - Query
Content Query_tblTeacher
Analyze SQLContent - yes
Allow Additions - yes
Allow Modifications - yes
Allow Deletions - yes
Add Data only - no
Naviagation Bar - yes
Cycle no

Table is editable
Query is not editable - I assume that is the problem.

I do not follow waht you are saying about SQL-string

Thanks Paul
OOo 2.3.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Adding/editing data

Post by Villeroy »

The problem is not related to the form. The form is based on a record set which is not editable for some reason. Get the querie's SQL-string ("Edit in SQL view") and paste it here.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
paulb
Posts: 6
Joined: Fri Dec 05, 2008 6:06 pm

Re: Adding/editing data

Post by paulb »

Is this what you requested:

SELECT "name" AS "name", "grade" AS "grade", "course" AS "course", "course #" AS "course #", "comments" AS "comments", "addcomments" AS "addcomments", "FN" AS "FN", "LN" AS "LN", "STudID" AS "STudID", "teacher" AS "teacher" FROM "tblTeacher" ORDER BY "name" ASC

Paul
OOo 2.3.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Adding/editing data

Post by Villeroy »

Simply an ordered list from single table "tblTeacher" which is editable, I suppose. A record set can not be editable unless the primary key is included. The database engine has no evidence about the uniquely distinguishable rows. Without PK it's an unstructured hash of data. I think, you left out the primary key because it is an auto-value which does not deserve to be visible on a form.
Try this instead:

Code: Select all

SELECT * FROM "tblTeacher" ORDER BY "name" ASC
which simply selects all the fields. Now your form operates on a writable record set, even if there is no visible control representing the primary key. No need to edit the form.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply