Use list box selection to populate text field

Hi and thanks for reading.

I am creating a database with food orders and batches which both have a meal description originating in the same database table.

I need to match a batch with an order in a form whilst confirming that the meal descriptions are identical - a sense check for the user.

My idea is to populate the batch number from a drop down list then have a text box that displays the meal description, then have the same for the order. The user then compares the descriptions and ensures the details are correct.

Is there a way to display the description using a list box as input please?

Thanks

From this description, it’s not entirely clear how orders, batches, and meals are related. My general answer should apply, but you may need to adapt it to your data.

Instead of using a separate text box, display the description and then bind the list box to an ID number. For example, the following SQL command could be used for the list box.

SELECT ORDERS.ID || ' - ' || MEALS.DESCRIPTION, ORDERS.ID
FROM MEALS, ORDERS
WHERE MEALS.ID = ORDERS.MEAL_ID
ORDER BY ORDERS.ID

The first column is to display in the list box, and the second is the bound field, in other words, the value that gets written to the table of the form.

It does not sound like there is any need for the meal ID to be stored both in the order table and in the batch table. A query can join them, and it is better to only store the information once.

Example file: food orders.odb