| View previous topic :: View next topic |
| Author |
Message |
TECenery1 Newbie

Joined: 05 Sep 2009 Posts: 2
|
Posted: Sat Sep 05, 2009 4:49 pm Post subject: How to save a foreign key using a combo box (dropdown)? |
|
|
I am a modest MS Access/ VBA programmer. I am very new to OOo but think it would be great to recreate some MS Access mdb's in OOo Base 3.1 odb's.
In MS Access, the Combo Box has properties for "Bound Column" and "Column Width" and is thereby able to contain multiple columns per row (and a column - i.e. a key column - can be hidden by setting "Column Width="0"). Using these Combo Box properties, it is easy to save the key (Bound Column) of the selected row as a foreign key in another table when a meaningful description is selected by the user.
I do not see the same properties in OOo Base Combo Boxes. So, how do I save the key and not the description (which could potentially later change so I only want to change it in one location).
An example...An Address table with a foreign key to a Type table depicting the type of record (family=1, friend=2, Colleague=3, Business=4, Medical=5, etc). So what is the code I need that will display the Type descriptions but save the key of the selected Type in Address, and vice versa upon loading the form to read the saved key and display the associated description in the list of Type descriptions?
Sample code would be awesome!!!
Many thanks in advance for any attention. _________________ Can't do it if you don't try! |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
Posted: Sun Sep 06, 2009 1:35 am Post subject: |
|
|
Hello
Activate the wizard on the toolbar
create a listbox and the wizard will help you to select the parts.
I think it is better to use a listbox then a combobox
read the tutorial from Benitez and visit Sheepdogs
Use also the "form navigator". Button is on an other toolbar.
Romke |
|
| Back to top |
|
 |
TECenery1 Newbie

Joined: 05 Sep 2009 Posts: 2
|
Posted: Wed Sep 09, 2009 11:32 am Post subject: Thanks so much |
|
|
Very interesting! I will give it a try and let you know how it turns out!
Thanks _________________ Can't do it if you don't try! |
|
| Back to top |
|
 |
|