Updating Multiple Fields fro ListBox

Have a need of updating multiple Fields of a Main Form, by using a ListBox and selecting a Record from which the fields to be copied/update the multiple Fields of the Main Form Table.

Thanks for your answer. I assume that my Database is HSQLDB. I came for a need to write an application that will calculate the total of food ingridients for entire day. Such as Carbs, Protein, Sodium, etc. Basucally there are two main tables. Table 1: Food Table: Food Id, Food Product, Weight, Carbs, Protein, etc… Table 2: Consumption for day: Actual Consumption ID,Food Id, Weight, Calories, Carbs, Protein.

For every record I add in Table 2. I need to open a listbox of Table 1 and choos what food I want to select. That record of food of table1 will be added to Table2 including multiple fields of Table1. At the end of the day I want to sumup the total on all fields of Table2.

Main Form will open Table2, With the aid of ListBox and selecting a Record from which the fields to be copied/update the multiple Fields of the Main Form Table2. Please see attchment.

Thanks.FOOD_MENU 7_23_20.odb

Hello,

Don’t know the database you are using (Base is the front end to many possible).

Probably the way to do this is macro(s). This must be written for your specific needs which requires more details and a sample.

Thank you for your response. I am using Libre Office Base 6.4.5.2.
Is There any Macro example you can attach that does this. Thanks.

As this is a very unusual request, and not even certain exactly what you need, there are no specific macros to guide you to. Again, this must be written for your specific needs which requires more details and a sample.

And you still have not specified what database you are using. Base is not a database. It is a front end to a database. Examples are HSQLDB embedded, Firebird embedded, PosgreSQL, MySQL, SQLite, MariaDB, etc. Base has both HSQLDB embedded and Firebird embedded available from within LO.

Hello,

Thank you for correcting the post. Have given a bit of thought to you question. It may not require any code but rather a different approach and SQL. May take a day or two for some result.

Thank you very much for your beautiful and clean solution.

Hello,

Have attached a sample. There are two new tables: DailyFoodIntake and FoodConsumed. The first is the person and the second are the items for the meals/day.

There are two new forms. DailyFoodIntake allows the entry of items. On the main form select the person. On the sub form select items. Most columns are list boxes for easy selection. The date field is also a dropdown for easier selection.

The second form TotalsByDayPerson is generated using a query by the same name. It presents totals for each day for each person.

All presented is very general and you can elaborate from this.

Sample ----- FoodMenuPost.odb

If this answers your question please tick the :heavy_check_mark: (upper left area of answer). It helps others to know there was an accepted answer.

Thank you for your help and solution, please give me a few days so I can study what you did. Thanks you again.