Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / June 2006

Tip: Looking for answers? Try searching our database.

Rule to Stop a Query if Invalid Search Criteria

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mikeg - 08 Jun 2006 16:47 GMT
I want to prevent a query from running if a field is blank or contains an
invalid value. In the Run Query button properties, I created a Rule that
fires when the field value is blank or invalid. Then I added an Action to
send an error msg. This part is working fine.

However, after clicking OK on the msg dialog, InfoPath goes ahead and runs
the query anyway! I don't see any Action available to stop the query from
continuing other than "Open a new form to fill out" or "Close the form" which
are both overkill.

Note: I'm using the Rules and Custom Code Action in the query button for
some code that calls a stored procedure. It's working except that if the
search criteria is invalid my error msg will display, but then InfoPath
continues to run the query which I do not want.
brianmiller77@gmail.com - 08 Jun 2006 17:34 GMT
Mike,

Break your rule up into 2 different rules.

1st rule: check value for validity and if invalid show message box.
check the box at the bottom to stop processing rules.
2nd rule: set to condition to always run and query data

so if 1st rule runs because of an invalid field, 2nd rule won't run.
if field IS valid in 1st rule then rule will be skipped and 2nd rule
will run.

hope that helps.

Brian Miller

> I want to prevent a query from running if a field is blank or contains an
> invalid value. In the Run Query button properties, I created a Rule that
[quoted text clipped - 10 lines]
> search criteria is invalid my error msg will display, but then InfoPath
> continues to run the query which I do not want.
mikeg - 08 Jun 2006 18:07 GMT
Brian, thanks for the quick response. My form has four fields that can be
used for search criteria. I have four Rules defined. The first rule checks to
see if all four fields are blank and prints an error msg. "Stop processing
rules when this rule finishes" is already checked.

InfoPath correctly bypasses the other rules when the first rule fires, but
Infopath runs my custom query anyway. Adding another Rule at the bottom to
always run the query would be redundant in this case since it already runs
the query without such a rule.

I wonder if I need to add some logic to my custom Jscript query...
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.