Ask Your Question
0

Create a dropdown, dependant on another dropdown

asked 2019-10-09 12:33:26 +0200

Jon170579 gravatar image

updated 2019-10-09 21:38:04 +0200

I am relatively new to Libre Office after switching to Mac OS. I only use the base application due to MS Access not being available for OS.

I am creating a database that will have 2 tables "Product Type" and "Product" potentially there can be hundreds of products, hence the genre which could split it down when searching the product.

I have got as far as designing the input form and on the data sheet input for "type" and "Product" made them a dropdown box. each of these link back to tables that hold the possible information. the 2 tables are linked with a relationship.

Any help on this will be greatly appreciated.

edit retag flag offensive close merge delete

Comments

@Jon170579,

In future along with OS used (should be more specific), please include specific LO version and with Base, the database used and related info (connector, version) if applicable. This most often comes into play when answering questions.

Ratslinger gravatar imageRatslinger ( 2019-10-09 20:19:38 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-10-09 20:13:27 +0200

Ratslinger gravatar image

updated 2019-10-09 23:57:08 +0200

Hello,

Base does not have the built-in ability to create a list box based upon another list box as I seem to recall Access does. You do this using table filtering and sub forms. For reference to table filtering see this post -> Filter/Search with Forms (leveraging SubForms). There are also a variety of samples on the post.

Now your solution can be done with or without macros. Have attached a sample without using macros.

In the sample there are two forms. One simply for data entry to help populate the tables. The second form 'ProductListboxSelection' is what your question requests.

The main form is a list box tied to the 'Product Type' table and the 'id' is saved in the 'lb1select' field of the filter table. Then there is a subform based upon a query. This creates a list of products based upon the selection of the first list box. The button here refreshes this list after selecting an item from the first list box. The the 'id' is saved in the 'lb2select' field of the filter table. Next is the subsubform. This is the detail for the selection of the second list box. It is linked to the filter table field 'lb2select' and pressing the second button now selects the specific item.

Sample --------- ListboxFromListbox.odb

The LO documentation may also be of help -> LibreOffice Base Handbook

Edit:

Per the comment attached, it appears this is about two list boxes (dropdown is not a good term as it may relate to multiple controls) in a table control record.

Have a sample of this in my answer on this post -> How to use user selected value from combobox1 in combobox2 'SELECT' statement.. The macros would need to be modified to fit your needs - tables, fields, etc.

edit flag offensive delete link more

Comments

Thanks for your reply but my drop down boxes are in a sub-form table control. is there anyway I can upload my file I am struggling

Jon170579 gravatar imageJon170579 ( 2019-10-09 21:37:04 +0200 )edit

This is critical missing information to the question and caused undo time expended.

You can upload a file by editing your question. Then on toolbar in upper left corner of question, use the paperclip icon to upload a file.

This new twist will most likely require a macro specific to your needs.

Ratslinger gravatar imageRatslinger ( 2019-10-09 21:47:45 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-10-09 12:33:26 +0200

Seen: 27 times

Last updated: Oct 09