[Solved] Form will not do 2 adds sequentially

Creating and using forms

[Solved] Form will not do 2 adds sequentially

Postby Buz » Tue Feb 28, 2017 2:42 pm

Hi all.

I'm finishing a test app that I will use to teach students. My question concerns form "Assignments, mainform listbox (FILTER tbl), subform1 grid, subform2 flds"
in the attached odb file.

I select EMPLOYEE in MAINFORM. The selected EMPL_ID is saved in FILTER table.
SUBFORM holds a grid with previously assigned tasks, intended for display only.
I have a 2nd subform: NEWTASKFORM.
I enter data in NEWTASKFORM fields and press SAVE ASSIGNEMENT, then REFRESH TASK LIST to update the SUBFORM grid.
NEWTASKFORM has table ASSIGNMENTS assigned and Link Master fields: ASSIGNMENTS.EMPL_ID and FILTER.EMPL_ID
The first add works as expected.

BUT when I try to immediately add a 2nd assignment, it does an update instead. If I close and re-open the form it will save the first add but not the 2nd.

I'm sure I'm doing something silly, but I don't see it. So any help will be appreciated. But note: I'm improving! :D

Thanks,
Buz
Attachments
TestDB.odb
(61.75 KiB) Downloaded 42 times
Last edited by Buz on Tue Feb 28, 2017 7:34 pm, edited 1 time in total.
OpenOffice 4.1.3, HSQLDB 2.3.4 embedded, Win 10; LibreOffice 5.2.4
Buz
 
Posts: 42
Joined: Wed Sep 09, 2015 8:38 pm

Re: Form will not do 2 adds sequentially

Postby chrisb » Tue Feb 28, 2017 5:12 pm

Buz, when you hit the 'Save Assignment' button you are simply saving the current record, the record pointer remains stationary pointing at the current record.
the easiest way to solve the problem is to change the action from 'Save' to 'Refresh' & using the form navigator drag the button 'Save Assignment into the 'MainForm'.

when a mainform has more than one subform then it's always best to use two buttons 'SAVE' & 'REFRESH' this ensures that data is always accurately attributed to the named employee & all subforms are refreshed.
check out the form 'Assignments, mainform listbox (FILTER tbl), subform1 grid, subform2 flds_NEW'.
it uses 1 'SAVE' & 2 'REFRESH' buttons all of which are placed in the mainform.
TestDB.odb
(70.76 KiB) Downloaded 45 times
open office 4.1.4 & LibreOffice 5.4.2.2 (x64) using HSQL 1.8.10 (Embedded) and HSQL 2.4.0 (Split) on Windows 10
chrisb
 
Posts: 149
Joined: Mon Jun 07, 2010 4:16 pm

Re: Form will not do 2 adds sequentially

Postby Buz » Tue Feb 28, 2017 7:32 pm

Thanks, chrisb. That does the trick, 'tho itd be nice if we could have one button press do both fuunctions. I'm still in 4GL mode, I guess.
Buz
OpenOffice 4.1.3, HSQLDB 2.3.4 embedded, Win 10; LibreOffice 5.2.4
Buz
 
Posts: 42
Joined: Wed Sep 09, 2015 8:38 pm

Re: [Solved] Form will not do 2 adds sequentially

Postby Arineckaig » Wed Mar 01, 2017 1:48 pm

I'm finishing a test app that I will use to teach students.
..... 'tho itd be nice if we could have one button press do both fuunctions.

A key element of the form/sub-form paradigm of the AOO Base GUI is that a change of record pointer in a main form updates ALL sub-forms linked to it. Thus one method to avoid the need for update button(s) is to ensure a record change when a selection is made in the main form.

For example, change the data source for the main form to be the EMPLOYEE table with a grid form control whose single column displays a list of Employee Names. A change in the name selected in that list represents a record change and all sub-forms linked to the EMPL_ID [the field not necessarily included in the grid control] will be automatically updated by the Base GUI. If there should be a large number of Employee records the single column grid control becomes cumbersome, but readily overcome by adding a grandparent main form with a similar single column grid control to act as an index/filter to employee names displayed in what will then become a parent sub-form. Even a cumbersome alternative can help students to gain a deeper understanding of the GUI principles that underlie the form/sub-form relationship in AOO Base.
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
OOo 4.1.1 on MS Windows XP MySQL and HSQLDB
Arineckaig
Volunteer
 
Posts: 827
Joined: Fri Nov 30, 2007 10:58 am
Location: Scotland

Re: [Solved] Form will not do 2 adds sequentially

Postby Buz » Wed Mar 01, 2017 2:16 pm

Thanks for sharing this clear statement of how record pointers operate.

I changed the listbox to grid last night and all simplified as I hoped. But the grid is not a good tool for accessing many records, so I added an ancestor form to update FILTER before opening the ASSIGNMENT form. All works as desired. The latter approach also simplifies the design. Mainform and 2 subforms is a little too busy. Still further to go.

It's becoming clear that to use OO/LO Base effectively, we have to take into account it's design strengths and weaknesses. Is there a document/URL that summarizes all this so that those of use who are new to Base can reach the promised land sooner?

Buz
OpenOffice 4.1.3, HSQLDB 2.3.4 embedded, Win 10; LibreOffice 5.2.4
Buz
 
Posts: 42
Joined: Wed Sep 09, 2015 8:38 pm


Return to Forms

Who is online

Users browsing this forum: No registered users and 6 guests