This is a great utility which i have used countless times to generate CAML Queries.
Enjoy....
http://www.u2u.net/res/Tools/CamlQueryBuilder.aspx
The below article explains how to setup a your InfoPath environment for local debugging...
http://support.microsoft.com/kb/555963