Form startup weirdness

P

Paul Waldo

Hi all,

I'm getting strange behavior on form startup. I have a form that is
designed based on an Access database, where the data is loaded on
startup. It works fine in design mode. I publish it to a directory and
it might open fine a couple of times. After that, I get errors. The
form displays then I get the dreaded
"This form cannot be filled out because of an error in the forms design.
Contact the author of the forms template to resolve the issue"
dialog. This dialog only has an OK button with no diagnostics.

I then get another error dialog, but one where I can get diagnostics.
The error is
"A floating attribute may not be passed as the context node for an XSLT
transform or an XPath query."
I then get a number of error dialogs of the first type.

I know the form is OK, because when I design the .xsn file that gave the
errors, Preview Form works fine.

It seems the only solution to fixing this problem is to republish from
the Visual Studio source. The published form works well for a while,
but then "rots" back into the above error mode.

Has anyone experienced this issue or developed a work-around? I've seen
this in a number of my forms, so I know it is not tied to just one form.
Thanks in advance!

Paul
 
P

Paul Waldo

I have found the source of the problem: the form was designed based on
a database and I have the following code in the OnLoad event handler:

object o;
ADOAdapterObject dataObj;

o = thisXDocument.QueryAdapter;
dataObj = (ADOAdapterObject) o;
dataObj.Query();

I have this code because I don't want the user to be forced to press a
"Run Query" button when the form opens.

Based on the behavior, I assume that when the form exits, a database
connection is not closed. Does anyone have a suggestion for fixing the
above code or somehow automatically running the query? Thanks in advance!

Paul
 

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