Base: save form field values to table

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 pitifulMath-01.odb efforts and point me in the right direction. Thank you.

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


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:

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:


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

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.


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…

Thank you, @Ratslinger

@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.


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, the more I learn the less I know. Shall I ask as new, or wait here?


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


And yes, a new question would be better.

@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 messing up with the list box. He does so at his own pearl, and the name shown will be visible. I am very open to any other ideas.

I will fix the message box cancel. I overlooked that.


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!