The Object Model is different between InfoPath 2003 and 2007 – so if you are using InfoPath 2007 and need to design an InfoPath 2003 compatible template, it has to be explicitly saved that way (Save As, then use the drop down for file type to pick 2003). Also, make sure to change the OM under Form Options / Programming. I think you did this already, since the code works for 2003.
You might want to check that the InfoPath 2007 machine has the latest Office Service Pack.