[Solved] Show Names in Subform Grid, not iD

Creating and using forms
Post Reply
zizo
Posts: 5
Joined: Mon Mar 29, 2021 12:34 am

[Solved] Show Names in Subform Grid, not iD

Post by zizo »

Hi,
I am new to this forum. I have tired to search but I wasn't quite successful.

So I created an example DB which shows my Problem.

I have these Tables:
Shops
ProductCat(egory)
Product
Order
Order Sub

My Question belongs mainly to Order and OrderSub

In Order I want to save general information and in OrderSub the detailed positions.

My Problem ist that I dont want to see the ProductID, I would like to see the ProductName in the Subform Grid or even choose the Product via a Dropdown field.
In my real DB I have a couple more of these ID Columns.

Could you please help me?

Best
zizo
Attachments
order.odb
(20.56 KiB) Downloaded 275 times
Last edited by zizo on Tue Mar 30, 2021 9:56 pm, edited 1 time in total.
Open office Apache 4.1.9 on macOS 11.1
UnklDonald418
Volunteer
Posts: 1544
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Show Names in Subform Grid, not iD

Post by UnklDonald418 »

A List box is the solution to your problem.
Open the form document 10_Order in the Edit/Design mode
Right click on the table heading for ProductID
select Replace With > List Box
Right click again on the table heading for ProductID
this time select Column to open the Properties List Box dialog.
Select the Data tab.
The Data field should show ProductID
On the line Type of list content change the selection to Sql
On the line for List content select the ellipsis at the far right to open the query design dialog
click on table 03_Product to add it to the query
Select Product for the first query column, this is the display field for the list box, it will show the text in the Product field of table 03_Product
For the second column add ProductID, this is called the Boundfield, the integer value associated with the product.
It might be a good idea to select Sort Ascending for the Product column.
Run the query to verify that the Product name appears in the left column and the integer value for ProductID is in the right column.
Exit the query design dialog and the query will be automatically saved as the List content.
Exit Design Mode and the Column named ProductID should now show the product name, even though the integer value of ProductID is still what is stored in the column.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
zizo
Posts: 5
Joined: Mon Mar 29, 2021 12:34 am

Re: Show Names in Subform Grid, not iD

Post by zizo »

GREAT.

Thank you very very much for this detailed explanation
Open office Apache 4.1.9 on macOS 11.1
Post Reply