What it appears you need is a list box on the main form (containing Loco Description) and record data connected to it on a sub form (TabLoco table).
You can do this with table filtering. See this post for how that works → Filter/Search with Forms (leveraging SubForms).
Here is a sample of how it may be applied in your situation → ModelRailroading.odb
The sample differs in
TabLocoCodes as I can’t see need for both
Another potential problem seen is in
TabLoco. You have an image field. There are two ways to implement images - embedded and linked. With embedded the entire image is in the DB. Linked is just that, a link to the image. With the default DB (HSQLDB v1.8 embedded) there is a tendency to lose data when storing images (or large amounts of data). This is not present in most other DB’s including HSQLDB split. Therefore, if you are going to include images, best to do so as linked or change DB’s. See this post → How to insert a link to an odb database to display an image.
Thank you for posting the sample. Would have a harder time trying to figure out the problem without it.
You are trying to accomplish with a list box something it is not meant to do. A list box can display one piece of information and save another into a field but you are wanting to display one and save two others in two different fields. Right now you display the Name & save the ID in LocoCodeID. In addition your question wants to save the LocoCode in LocoType. Not capable with a list box unless you write macro code to do this.
Now what seems to be a better solution is to change the key in TabLocoCodes. Drop the ID & make LocoCode the primary key. It is unique and makes LocoCodeID unnecessary. The listbox then uses:
"SELECT "Loco Description", "LocoCode" FROM "TabLocoCodes""
No code needed and you still have proper links between tables (TabLocoCodes.LocoCode->TabLoco.Loco Type - a one to many relation). Of course you need to delete the old relation & set the new one.
If this answers your question please tick the (upper left area of answer). It helps others to know there was an accepted answer.