Hello,
have you tried this?
Sub XDocument_OnLoad(eventObj)
XDocument.QueryAdapter.Query()
XDocument.View.ExecuteAction "xCollection::insert", "form_data_67"
End Sub
Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website:
http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(
http://www.infinitec.de/software/mistaya.aspx)
I actually have 3 tables from 1 database/data source, all 3 tables have
a
Person# as the "connecting field". Table 1 is used in my queryFields
with
an
Account# which is programmatically populated into the XML (programmer
does
this). The form is set to Query OnLoad. Tables 2 (patient
demographics)
and
3 (data from doctor's note) are then queried. Data then can be added
or
updated by the user and submitted back to the data base. All of this
is
working, however if there is no data returned from Table 3 then the
Optional
Section containing the dataFields for Table 3 will not display on the
form.
The user will have to click "Insert" in order to fill in the data and
submit
it back to the database. I have the Optional Section set to be
included
in
the form by default (using the sections properties dialog) but it
doesn't
if
there is no data returned to those fields. I have attempted the
following
line of code which I have discovered here in the discussion forum but I
recieve an error message.
Line of Code:
Sub XDocument_OnLoad(eventObj)
XDocument.QueryAdapter.Query()
XDocument.View.ExecuteAction("xCollection::insert", "form_data_67")
End Sub
Error Message:
InfoPath cannot open the selected form because of an error in the
form's
code.
The following error occurred:
Cannot use parentheses when calling a Sub
File:script.vbs
Line:38
XDocument.View.ExecuteAction("xCollection::insert", "form_data_67")
Any help or advise will be welcomed with open arms as I have been
fighting
with this form for 2 weeks now.
Thanks
Mdsmitty
:
Hello,
how do you query the secondary database now? By code or do you have
bound
it
to something?
Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website:
http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(
http://www.infinitec.de/software/mistaya.aspx)
I have a form that querys 2 data tables. The second table does not
contain
any data thus the Optional Section which contains the dataFields
will
not
open, forcing the user to open the section manually (clicking Insert
Section)
in order to enter data. I would like to have the section open on
the
form
automatically so the user does not have to click on the link to open
the
section. Is this possible and if so, does anyone have sample code
to
help
me
accomplish this as I am a novice at VBScript.
The XOptional value of the section is: form_data_67
Thanks
Mdsmitty