by Villeroy » Thu Jun 06, 2019 1:49 pm
1) I stripped the macros and forms andadded a unique index on color names so the table won't accept duplicate names.
2) I let the form wizard create a new MASTER form.The wizard can not produce list boxes. The context menu of any visible control has a submenu "Replace with...", so I replaced the color ID box with a list box. A working list box has a first column of visible text (color names) and an invisible column keeping the primary key of some other table (IDs of colors), ordered by the visible names. See data properties of the form.
3) I added a most simple logical form to the same form document which serves the only purpose to insert a new color name into the color table. Property "New Record Only" and no navigation bar. Notice that the form is not a subform of another form as shown in the forms navigator from which I added a screenshot.
3a) The form has an OK button by default pushed when you finish the name entry with Enter. The action property of the OK button is set to "New Record", so the field is cleared after the new record has been saved.
3b) The cancel button can be used to cancel the entry of a new name.
So far the form works well. You can enter a new name, go back to the main form's list box and then click the second refresh button.
3c) The text box where you enter the colour name is a combo box showing already names: SELECT DISTINCT "COLOUR" FROM "COLOUR" ORDER BY "COLOUR"
4) I added a hidden field to the new-color-form named "AutoRefresh". Its string value points to the other form's list box. I also added a comment to that control. If you installed my AutoRefresh.py module you can easily activate that macro without further customization. Hidden fields are made for macro customization.
5) There is a close button on the form which works without any macro code. See button properties.
- Attachments
-
stampEXAMPLE_Villeroy.odb
- One-to-many with new-item form
- (27.15 KiB) Downloaded 31 times
Last edited by
Villeroy on Thu Jun 06, 2019 3:22 pm, edited 1 time in total.
Please,
edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x