code for Run Query button

E

Eric

Is there anywhere documented what the guts of what is running behind the Run
Query button?

What I want to do is set some flag when you press the Run Query button, but
the default button allows you nothing, other than to modify itself.

Any sites that explain it?
Thanks,
Eric
 
S

Scott L. Heim [MSFT]

Hi Eric,

You can reproduce what the Run Query button is doing by calling this code:

- VBScript:
XDocument.Query

- JScript:
XDocument.Query();

So if you change your button to use code, you can then set a flag, check a
condition, etc. before executing the query.

I don't know of any specific documentation/site stating the Run Query
button does "x" but you can see all the various methods, properties, etc.
available to you by doing these steps:

- Open an InfoPath form in Design View
- Display the Help Task Pane
- Click the Table of Contents link at the top
- Click the InfoPath Developers Reference at the bottom
- Click the InfoPath Object Model Reference

I hope this helps!

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
E

Eric

Yes, that queries the data, but it also submits a new row to the database,
which is not what I want. Is there another command that I can use?
 
S

Scott L. Heim [MSFT]

Hi Eric,

That seems odd because if you were going to "submit" data you would instead
call: XDocument.Submit.

If you click the default Run Query button, does it submit or just query?
The code I provided should work identically - if it is not, can you
describe a repro test for me?

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
E

Eric

I thought it was odd also, as I put it in the query, and as soon as I press
the modified Run Query button, it displayed below two records, I then looked
at the database and saw that there were two records

Let me try it again, and I will see if I can repo a demo and send it to you.
 
E

Eric

I just tested it again, and it does seem to be working as you had said,
thank you!

Eric
 
S

Scott L. Heim [MSFT]

Hi Eric,

That's great to hear!

Take care,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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