I see. The code in the first post is actually 2003 OM code, which is quite different from 2007 and 2010. On the other hand, IP 2010 still allows using 2003 code, so I'm not entirely sure why OP was having an issue.
And I now understand what you meant in that line I quoted. Code that works in 2010 should work in 2007 99% of the time, so no need to worry about that, but if you want to be sure, you can set a form's OM to the 2007 version in the form options.