I'm not a big fan of field validation except for certain specific tasks where it serves more as an "insurance policy" to back up other validation methods. I prefer scripted validation as I can design the interface to respond to different data entry errors more flexibly and present the user with more user friendly options for correcting errors.
But your expression would need to look like this:
PatternCount( Self; "and" ) = 0 and
PatternCount( Self; "but" ) = 0 and
PatternCount( Self; "or" ) = 0 and
PatternCount( Self; "for" ) = 0 and
PatternCount( Self; "since" ) = 0
All of the patterncount tests have to be true. You want an error message to pop up if any one of the tests fail.
But the above calculation still needs work. Text such as "Stand" will cause the first pattern count test to be false and "Door" would cause the third test to be false.
Here's a start and solving those issues, but may not be sufficient for all possible text entries or could be overkill for what you need:
Let ( TheText = " " & Substitute ( self ; ["." ; " " ] ; [¶ ; " " ] ; ["," ; " "] ; ["!" ; " " ] ; ["?" ; " " ] ) & " " ;
PatternCount( TheText ; " and " ) = 0 and
PatternCount( TheText ; " but " ) = 0 and
PatternCount( TheText ; " or " ) = 0 and
PatternCount( TheText ; " for " ) = 0 and
PatternCount( TheText ; " since " ) = 0
) // Let
Hard coding these words seems a problem to me. What about "if" or "than" for example? I don't have a better solution for you, bu it seems to me the list of prohibited words could become quite lengthy when you think about it. There is probably a limited number of conjunctions and you could easily find those words, but are you intending to limit only conjunctions?
Thanks Phil. Your help, insight and advice are always greatly appreciated. I will try my hand at incorporating this into scripts instead.
Rick, I am trying to prohibit certain words...not necessarily conjunctions. I was using conjunctions as an example. With that said, you're right that there's a large (and seemingly infinite) set of words that would need to be addressed. I realize there's no way I can address every possibility. For my solution, however, I believe I can remove 95% to 99% of problems by prohibiting the most commonly used "no-no" words.