No unsaved data warning in Form grid

Creating and using forms
Post Reply
the79bomb
Posts: 4
Joined: Fri Feb 19, 2010 1:54 am

No unsaved data warning in Form grid

Post by the79bomb »

I made a form to edit entries which involves cutting data from one entry and pasting into a new entry. I am using the grid control to show multiple entries to make this easier. I am doing all the editing in a subform and browsing through each entry in the main form to check for needed corrections. However if I do not remember to click on the last line in the sub form to save the data and absentmindedly scroll to the next record in the main form the data (which has been pasted into a new record or existing record) is lost without any warning. There is a green mark on the row but this is hardly conspicuous especially when doing hundreds of records manually. Is there a way to have the form automatically save the row on a paste or otherwise activate the "unsaved data" warning in a form? It seems the record only saves when clicking out of the row. Can it be made to save when clicking out of a cell or pasting? Why is there no "unsaved data" warning in the form when there is when editing the table directly? Any help would be appreciated.

Best Regards, Tim
Ooffice 3.00 Win7 home 64bit
ponlerd
Posts: 56
Joined: Sun Nov 15, 2009 6:22 pm
Location: Bangkok, Thailand

Re: No unsaved data warning in Form grid

Post by ponlerd »

Hi, I spent a few hours working on the same issue today. Fortunately I worked it out!
Unfortunately, my case is not exactly the same as yours, but it might help point you in the right direction.

My case is that I am editing data in a table grid on subform
If i do not move down to the next row, and click on the mainform, the last row will not be updated in the database table
The event before update, after update of the subform fires, but the last record row has not been updated to the database table yet,
only if i click the mouse on the subform again, then click on the main form, at that moment, the last record will be updated

so i tried to find a way to update the database AFTER ANY CHANGES MADE to the data in the subform,
so i have this macro attached to all of the columns in the subform grid , on the after update event to save the row everytime there is a change

which i got from here

http://www.oooforum.org/forum/viewtopic.phtml?t=79317

so i use

oForm = event.source.model.parent
If oForm.IsNew then
oForm.insertrow()
Else
oForm.updaterow()
End if

now every time that say, a textbox on the subform grid has been modified, after you press the tab to the next textbox, the row will be saved

hope it helps.
OOo 3.2 Ubuntu 9.04 / OOo 3.2 Windows7 / Migrating from Access
Post Reply