Hi
You could try this code with an OnSaveRequest - Tools, Form Options, Open and Save, Save using custom code - it works for me and you may be able to adapt it for your button.
Sub XDocument_OnSaveRequest(eventObj)
Dim PositionName
Dim InnovationUnit
Dim SaveFile
PositionName = XDocument.DOM.selectSingleNode("//my:myFields/my:field108").text
InnovationUnit = XDocument.DOM.selectSingleNode("//my:myFields/my:field109").text
SaveFile = PositionName & InnovationUnit
If XDocument.IsNew = True or eventObj.IsSaveAs = False then
If eventObj.IsSaveAs = True then
XDocument.UI.SetSaveAsDialogFileName(SaveFile)
End If
eventObj.IsCancelled = eventObj.PerformSaveOperation
eventObj.ReturnStatus = True
Else XDocument.UI.Alert("The 'Save As' function is disabled for existing forms.")
End If
End Sub
Gary