Hello to all,
I have created a CRM database to store my customers’ company details, personnel, visits on their companies. Although, there is something I would like to get fixed. Because this database will be managed by 2-3 people, I would like to avoid data loss. To get started:
Everything that is written in the form, even by mistake, (or maybe if someone erases data by mistake) is saved automatically on the record change. What I would like is to put a reminder before the record change to remind the user that somewhere he made changes. If he did it on purpose he will click “Yes” and jump to next record. If not, he will click “No”, the changes will revert and he will jump to next record.
Is there any way to do this without macro? If macro is the only way, could someone help me by creating the right macro for me?
Thank you in advance.
Just a macro code solution someone gave to me and it works. It now undo changes if you click “No”. The only disadvantage is that it warns you even when you click on save button:
sub BeforeRecordAction(oEvent as object)
dim oForm
select case oEvent.Source.implementationname
case "com.sun.star.form.FmXFormController" : oForm= oEvent.Source.model
case "com.sun.star.comp.forms.ODatabaseForm"
oForm= oEvent.Source
If MsgBox("Update record?", 4,"Confirm")=7 Then UndoRecord()
case "org.openoffice.comp.svx.FormController" : oForm= oEvent.Source.model
case else
rem print oEvent.Source.implementationname
end select
End Sub
sub UndoRecord
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:RecUndo", "", 0, Array())
end sub