We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

Base: save form field values to table

asked 2021-04-22 00:00:34 +0200

FKlusmann gravatar image

I am trying to build a Base Form that will select a student, store the ID, then allow for math practice problems. I would save the input into a table along with the calculated result and its grade. The direct data entry is working, however, I have been unable to save the calculated values into the table. I hope that someone will look at my pitifulC:\fakepath\Math-01.odb efforts and point me in the right direction. Thank you.

LibreOffice Portabel Ver (x64) Windows 10.0 AdoptOpenJDK-Hotspot 11.0.10

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-04-22 00:45:36 +0200

Ratslinger gravatar image

updated 2021-04-24 05:22:16 +0200


Much of this is confusing. It is a general practice to not store computed fields if the original data is present. HSQLDB embedded (your posted sample) does not have this capability. Firebird embedded does as do some other databases. Also it is easy enough to use SQL (a query) to compute any needed results.

For example:

Select "Math_ID", "Answer" As "Answer Given", "addend_1" + "addend_2" As "Correct Answer" From "Addition"

producing this:

image description

This can be further refined to group by student and more. SQL can eliminate many problems.

Another point of confusion is why there is a grade for each record. Seems this would be for the result of a group of questions per student.


How about:

image description


SELECT "Person_FK", Count("Person_FK") "Total", Sum("Answer") As "Correct",  (Sum("Answer") * 1.00 / Count("Person_FK")) * 100 As "Percent"  FROM 
(SELECT "Math_ID", "Person_FK",  Case  When "Answer" = "addend_1" + "addend_2" Then 1 ELSE 0 END As "Answer" FROM "Addition") Group By "Person_FK" Order by "Person_FK" asc

More can be done such as adding names. SQL!

Edit 2021-04-23:

While far from complete, attached is sample with items requested and a bit more.

Sample ------- Math-01.odb

edit flag offensive delete link more


You are fast, @Ratslinger. Thank you.

The teachers have been asked to evaluate various students in different ways. Some are given verbal questions, or written ~ add six and eleven ~, etc. so the questions will be entered by the student. For evaluation, they want all values. They wish to try and define weakness, such as a student needing help with 7s, or understanding the spoken word. Some students will be asked to make up 10 practice problems and work on their own. This is the logic for the table.

My problem is not so much as how to deal with the results, but how to keep the student's input and provide for a flag (grade) to see if ID 4 needs help with the number 7, or the word, or has done the work requested.

FKlusmann gravatar imageFKlusmann ( 2021-04-22 03:20:55 +0200 )edit


It appears it is just a matter of creating the SQL for the desired output. You can see from examples provided you can display various information without saving everything - just essentials. Also do not see any less than complex analysis to:

..see if ID 4 needs help with the number 7, or the word, or has done the work requested..

Ratslinger gravatar imageRatslinger ( 2021-04-22 03:39:34 +0200 )edit

Thank you, @Ratslinger

FKlusmann gravatar imageFKlusmann ( 2021-04-22 17:39:05 +0200 )edit

@Ratslinger, I am still confused.

(1) How may I select a person (Name) and have it remain thru several ~cycles~ or uses of the form?

(2) How may I get the Person_ID into each record of the table?

Again, Thank you, for your teaching and patience with me.

FKlusmann gravatar imageFKlusmann ( 2021-04-22 21:38:48 +0200 )edit


Sorry. Multiple questions in one - totals in record; record type selection; storing ID in record. Please in future only one question per. This is a question and answer site.

A quick look seems to indicate a re-work of the form and structure is needed. Will need a bit of time.

Ratslinger gravatar imageRatslinger ( 2021-04-22 22:19:24 +0200 )edit

@Ratslinger, the more I learn the less I know. Shall I ask as new, or wait here?

FKlusmann gravatar imageFKlusmann ( 2021-04-22 22:38:58 +0200 )edit


Until your comment only recognized you wanting to save totaled information. As stated this is not typically done and I really did not work with the form. Trying it now I see there are macros attached - nothing in question about that. A quick look at trying to decipher the code starts uncovering problems. For example you message box has a 'Cancel' button which is never checked. You are using 'dispatch commands' - not a good idea. Your idea of a list box to select student is not good. Students will mess this up. Can't see reason for having the correct answer & grade on same form as student entry.

I am no teacher but I certainly would not take this approach. So much for you to yet comprehend. Have you seen these:

Open Office Macros Explained by Andrew Pitonyak. PDF here -> OOME


http://www.pitonyak.org/database ...(more)

Ratslinger gravatar imageRatslinger ( 2021-04-22 23:12:57 +0200 )edit

@Ratslinger, thank you.

Yes, I have seen and read OOME and have the other PTF as well. My comprehension is obviously poor, which is why I ask. I understand that SQL may handle the correct answer and grade.

Consider that only 5 or 6 students sit in front of a non-networked machine during each class (about a month). The teachers wish to be able to walk by and minimize the form and look at the table to quickly see the last input. The last records will be from the student there at the time. (S)he can adjust her interaction with the student based on what she sees. Later (the end of the week?) there must be a way of identifying the work of John from Jane's. The Person_ID is needed with the record. Again, a form with SQLs may be used.

I am not worried about the student ...(plus)

FKlusmann gravatar imageFKlusmann ( 2021-04-23 18:07:00 +0200 )edit

Wow, You did it! @Ratslinger! Thank you!

I am trying to understand what you have done and OOME is not much of a help. BG64-BaseGuide.pdf and its examples still confuse me. I'll be studding you code!

FKlusmann gravatar imageFKlusmann ( 2021-04-24 17:10:33 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-04-22 00:00:34 +0200

Seen: 38 times

Last updated: Apr 24