M
mdsmitty
I have a line of code that works with a button control but I can't get it to
work with the OnLoad Event. I have been going around and around with this
for several days and need help.
This is the line of code I am using to have an Optional Section included by
default.
XDocument.View.ExecuteAction "xOptional::insert", "form_data_103"
I have tested this with a button control and the section opens, however, if
I add the same line of code to the OnLoad event, I get an error message. The
following shows my entire code for my OnLoad event.
'=======
' The following function handler is created by Microsoft Office InfoPath.
' Do not modify the name of the function, or the name and number of arguments.
' This function is associated with the following field or group (XPath):
/dfs:myFields/dfs:queryFields/q:form_data/@Document_ID
' Note: Information in this comment is not updated after the function
handler is created.
'=======
Sub XDocument_OnLoad(eventObj)
XDocument.QueryAdapter.Query()
XDocument.View.ExecuteAction "xOptional::insert", "form_data_103"
End Sub
I get an error message stating:
A run-time error has occured
Do you want to debug?
The following error occured:
Object required: 'XDocument.View'
File:script.vbs
Line:40
What I really don't understand is the fact that I have the Optional Section
control included in the form by default through the section's properties
dialog. I am querying a data source and in some cases there may not be any
information returned from the query and the user will enter a new
record/information to be submitted to the data source. It is in the case
that there is no info returned from the query that my optional section will
not display. I need the section to display at all times reguardless of the
query's result. If there is another method to accomplish the same result I
am open to suggestions. Unfortunately, I am a novice at writing script and
will need as much step by step as possilble. Further background on my
question can also be found with posting "Open Optional Section with VBScript"
on 6/8/05.
If anyone can help it would be greatly apprecitated. Thanks.
mdsmitty
work with the OnLoad Event. I have been going around and around with this
for several days and need help.
This is the line of code I am using to have an Optional Section included by
default.
XDocument.View.ExecuteAction "xOptional::insert", "form_data_103"
I have tested this with a button control and the section opens, however, if
I add the same line of code to the OnLoad event, I get an error message. The
following shows my entire code for my OnLoad event.
'=======
' The following function handler is created by Microsoft Office InfoPath.
' Do not modify the name of the function, or the name and number of arguments.
' This function is associated with the following field or group (XPath):
/dfs:myFields/dfs:queryFields/q:form_data/@Document_ID
' Note: Information in this comment is not updated after the function
handler is created.
'=======
Sub XDocument_OnLoad(eventObj)
XDocument.QueryAdapter.Query()
XDocument.View.ExecuteAction "xOptional::insert", "form_data_103"
End Sub
I get an error message stating:
A run-time error has occured
Do you want to debug?
The following error occured:
Object required: 'XDocument.View'
File:script.vbs
Line:40
What I really don't understand is the fact that I have the Optional Section
control included in the form by default through the section's properties
dialog. I am querying a data source and in some cases there may not be any
information returned from the query and the user will enter a new
record/information to be submitted to the data source. It is in the case
that there is no info returned from the query that my optional section will
not display. I need the section to display at all times reguardless of the
query's result. If there is another method to accomplish the same result I
am open to suggestions. Unfortunately, I am a novice at writing script and
will need as much step by step as possilble. Further background on my
question can also be found with posting "Open Optional Section with VBScript"
on 6/8/05.
If anyone can help it would be greatly apprecitated. Thanks.
mdsmitty