Syntax error-I'm getting desperate

J

Joanne

Hello again...
I'm sorry, I understand that the code is already meant for INFOPATH 2003.
But when I place the code in the ON LOAD event, it errors out on the first
line. It says that the "SelectionNamespaces" line has an incorrect syntax -
and I copied it directly from your response. Maybe I'm putting it in the
wrong place?

Thank you. I'm getting desperate!
 
Z

Zhang Haiguang

Hi Joanne,

Here is my script.vbs in my form template, hope it will be useful, and it
could query the main data connection(access database) by hand.
(Please replace
xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-03-13T10:33:26""
with the namespace uri in your form template.)

' 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:q=""http://schemas.microsoft.com/office/infopath/2003/ado/queryFields""
xmlns:d=""http://schemas.microsoft.com/office/infopath/2003/ado/dataFields""
xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution""
xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-03-13T10:33:26"""
'</namespacesDefinition>


'=======
' 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.
'=======
Sub CTRL5_7_OnClick(eventObj)
' Write your code here
XDocument.UI.Alert(XDocument.QueryAdapter.Command)
dim oldCommand
oldCommand = XDocument.QueryAdapter.Command
XDocument.QueryAdapter.Command = XDocument.QueryAdapter.Command + " where 1
= 1"
XDocument.Query()
XDocument.QueryAdapter.Command = oldCommand
XDocument.UI.Alert("selected")
End Sub

InfoJet Service
InfoPath Web Form
[http://www.infojetsoft.com]
 
J

Joanne

Thank you so much for all of your help.

Zhang Haiguang said:
And, my form template is designed in InfoPath 2003.

Zhang Haiguang said:
Hi Joanne,

Here is my script.vbs in my form template, hope it will be useful, and it
could query the main data connection(access database) by hand.
(Please replace
xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-03-13T10:33:26""
with the namespace uri in your form template.)

' 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:q=""http://schemas.microsoft.com/office/infopath/2003/ado/queryFields""
xmlns:d=""http://schemas.microsoft.com/office/infopath/2003/ado/dataFields""
xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution""
xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-03-13T10:33:26"""
'</namespacesDefinition>


'=======
' 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.
'=======
Sub CTRL5_7_OnClick(eventObj)
' Write your code here
XDocument.UI.Alert(XDocument.QueryAdapter.Command)
dim oldCommand
oldCommand = XDocument.QueryAdapter.Command
XDocument.QueryAdapter.Command = XDocument.QueryAdapter.Command + " where
1 = 1"
XDocument.Query()
XDocument.QueryAdapter.Command = oldCommand
XDocument.UI.Alert("selected")
End Sub

InfoJet Service
InfoPath Web Form
[http://www.infojetsoft.com]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top