I had issues intergating selections into my custom tools and for my purposes had to do it in Python. There is likely other ways to accomplish this. I stole this from a script that was referred to in a similair thread. The "%" symbols in this little piece of code do some sort of subtitution that gets around the problem with escaping all the quotes you think you would need by predefining the query.while counti <= done:
qry = "%s = %s" % (delimitedfield, counti)
arcpy.SelectLayerByAttribute_management("L_LYR", "NEW_SELECTION",qry)
arcpy.CopyFeatures_management("L_LYR", fcbase +str(counti))
counti = counti +1
Also the query may be on a GDB, MDB, Shapefile, SDE..... so to get around syntax differences for field names try adding something like this at the beginning of your script and instead of using the field use the variable.delimitedfield = arcpy.AddFieldDelimiters(LayeredLayer, 'Rank')