Environment: PC with Windows 10 Pro , 64 bit,
LO version 7.2
Firebird DB, installed as extended server on same PC
Firebird version 3.0
Description of the situation.
I am using a form to maintain a relational table between two parent-tables. (ie. Song and Performance)
The (Main)form shows one record of the Performance-tabel using a Query (so navigation is disabled)
A subform is defined for updating a relation-table to the Song table.
On the subform a listbox has been defined to maintain the relation-table (i.e. SongsPerPerformance)
The subform has navigation-buttons to scroll through existing entries and to add new ones.
To select a Song to be used a Listbox a defined to be used.
Issue description.
When starting the mainform everything is displayed correcty, but when there are no existing entries the in the relation-table following issue happens:
When than an entry is selected from the listbox to identify the Song to be linked and than the save-button is used an error-message is displayed “Object variable not set”.
When one of the navigation buttons is used (i.e. "first " or “last” or “new”) and than a selection from the list-box is made, followed by a save everything works fine.
All subsequent activitities for the same mainform-value work also fine as of that moment.
When there is initially an existing relation everything works also well when starting the form.
Its looks that initially the data-definition of the subform is not recognized when there is no entry in the relation-table.
Can anyone shed some light on this issue?
First picture : the data-structure
Second picture: the concerning form
- The mainform, base on a Query, showing one Performance (Optreden)
- A subform, base on a query, showing the current list of Songs per Performance, based on re relational table. This list will be updated if a change is made and a reload is performed.
(is not relevant for the issue mentioned) - A subform, used to maintain relationships between a particular Performance (listed in de mainform part) and Songs as defined in table T_Muziek (Songs), using T_MuziekUitvoering as data.
The red circle shows the linking between Performance and te relation-table
The Listbox (Muziektitel) is a query from table T_Muziek (Song) showing the titel and the key
The key in the listbox points to the foreign key in the relation table.
The field with M as label is the key to Songs, once selected in the listbox
The image shows the initial form for a Perfomance without any connected Songs.
When now selecting an entry from the listbox and pressing the save-button (Opslaan) an error is shown.
When first using one of the other navigation buttons and than selecting an entry and hitting save no error is show and the relational record is created.
Hopefully this (long) story clearifies my earlier remarks.
I did some further investigation and found something:
After loading or reloading the form I issued a oForm.First statement in a macro if the listbox is empty, which is the case when no relationships do exist.
Interesting enough that disabled the listbox and enable the same when hitting the “new-record” button.
This is a somewhat cumbersome slution, but it works.
Anyway, a better solution is always welcome!
Sorry for not expressing the issue clearly enough:
Forget the query-base subform as listed under number 2, that may confusing.
The subform at the bottom is connected to the relational table, which has two foreign keys:
one to the Performance table (as listed and linked on the main form part 1) and another to the Song table. The key to the song-table is obtained from the listbox (select key and name from song-table,
The listbox data property (using the first field) is pointing to the relation table field, holding the foreign key to song table)
The actual issue therefore is that LO does not have a current recordset to work with when no relation records do exist when opening the form. Using oForm.first resolves that, but is not a nice solution. The other “solution” would be to force the user the use a navigation button before using the listbox, but when the user accidentally uses the listbox first we have still the issue.
Gentlemen,
I have just created a simplified testform doing the same as the form giving the error when starting with an empty record set in de subform. This testform works correctly.
The difference between the two forms is that the testform is using the standard navigation method while the other uses own navigation buttons.
I have also successfully installed the indicated firebird fix, but don’t know where to find the content.xml file and do not understand what to do with it.
I am also a bit confused by the fact that three people trying to respond, but appreciate the help anyway.