I have a very simple form with the usual fields for the name, including one for a Preferred Name (or nickname). After entering the First Name (so “When losing focus” event) if there is nothing in the Preferred name control, the following Macro will put the First Name in as the Preferred Name:
Sub CheckFirstName
’
oController = thisDatabaseDocument.currentController
If not oController.isConnected then oController.connect
’
Dim sPrefName as String
’
oDoc = thisDatabaseDocument
oForm = ThisComponent.Drawpage.Forms.getByName(“MainForm”)
sPrefName = oForm.getByName(“txtPrefName”).Text
If sPrefName = “” Then
sPrefName = oForm.getByName(“txtFirstName”).Text
End If
oForm.getByName(“txtPrefName”).Text = sPrefName
oForm.isModified = true
’
End Sub
’
Without the line “oForm.isModified = true” the save icon does not activate. With it, the save icon activates BUT clicking it gets the error message that nothing has changed so it won’t save.