Hi Roger,
When you first create an InfoPath solution, if you immediately open the
script editor (ALT+SHIFT+F11), you will see the following:
' This file contains functions for data validation and form-level events.
' Because the functions are referenced in the form definition (.xsf) file,
' it is recommended that you do not modify the name of the function,
' or the name and number of arguments.
' The following line is created by Microsoft Office InfoPath to define the
prefixes
' for all the known namespaces in the main XML data file.
' Any modification to the form files made outside of InfoPath
' will not be automatically updated.
'<namespacesDefinition>
XDocument.DOM.setProperty "SelectionNamespaces",
"xmlns:my=""
http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-07-
29T12:56:06"""
'</namespacesDefinition>
If you simply add the following below what already exists, the variable
will be "global:"
Dim strName
You could then set that variable on the Load event of the form:
Sub XDocument_OnLoad(eventObj)
strName = "Scott"
End Sub
And you can still access that information from the click event of a button:
Sub CTRL1_5_OnClick(eventObj)
XDocument.UI.Alert strName
End Sub
I hope this helps!
Scott L. Heim
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.